Skip to content

Instantly share code, notes, and snippets.

@akisute
Created May 5, 2014 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akisute/a8c07c8c0f1505de9991 to your computer and use it in GitHub Desktop.
Save akisute/a8c07c8c0f1505de9991 to your computer and use it in GitHub Desktop.
Google Guava ROCKS
public int getCryptoTypeDumb() {
// With Plain Java
List<Network> networkList = new ArrayList(mNetworkSet);
Collections.sort(networkList, NetworkComparators.CRYPTOTYPE_WEAKEST_TO_STRONGEST);
return networkList.get(0).getCryptoType();
}
public int getCryptoType() {
// With Google Guava
return Ordering.from(NetworkComparators.CRYPTOTYPE_WEAKEST_TO_STRONGEST).min(mNetworkSet).getCryptoType();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment