Java Code Examples for com.google.common.collect.Ordering#immutableSortedCopy()
The following examples show how to use
com.google.common.collect.Ordering#immutableSortedCopy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DexAnnotator.java From ZjDroid with Apache License 2.0 | 6 votes |
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }
Example 2
Source File: DexAnnotator.java From zjdroid with Apache License 2.0 | 6 votes |
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }
Example 3
Source File: DexAnnotator.java From AppTroy with Apache License 2.0 | 6 votes |
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }
Example 4
Source File: DexAnnotator.java From HeyGirl with Apache License 2.0 | 6 votes |
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }
Example 5
Source File: DexAnnotator.java From ZjDroid with Apache License 2.0 | 6 votes |
public void writeAnnotations(Writer out) throws IOException { List<MapItem> mapItems = dexFile.getMapItems(); // sort the map items based on the order defined by sectionAnnotationOrder Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() { @Override public int compare(MapItem o1, MapItem o2) { return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType())); } }); mapItems = ordering.immutableSortedCopy(mapItems); try { for (MapItem mapItem: mapItems) { SectionAnnotator annotator = annotators.get(mapItem.getType()); annotator.annotateSection(this); } } finally { dexFile.writeAnnotations(out, this); } }
Example 6
Source File: TypeToken.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
private static <K, V> ImmutableList<K> sortKeysByValue(final Map<K, V> map, final Comparator<? super V> valueComparator) { Ordering<K> keyOrdering = new Ordering<K>() { @Override public int compare(K left, K right) { return valueComparator.compare(map.get(left), map.get(right)); } }; return keyOrdering.immutableSortedCopy(map.keySet()); }
Example 7
Source File: TypeToken.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
private static <K, V> ImmutableList<K> sortKeysByValue(final Map<K, V> map, final Comparator<? super V> valueComparator) { Ordering<K> keyOrdering = new Ordering<K>() { @Override public int compare(K left, K right) { return valueComparator.compare(map.get(left), map.get(right)); } }; return keyOrdering.immutableSortedCopy(map.keySet()); }
Example 8
Source File: TypeToken.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
private static <K, V> ImmutableList<K> sortKeysByValue(final Map<K, V> map, final Comparator<? super V> valueComparator) { Ordering<K> keyOrdering = new Ordering<K>() { @Override public int compare(K left, K right) { return valueComparator.compare(map.get(left), map.get(right)); } }; return keyOrdering.immutableSortedCopy(map.keySet()); }
Example 9
Source File: TypeToken.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
private static <K, V> ImmutableList<K> sortKeysByValue(final Map<K, V> map, final Comparator<? super V> valueComparator) { Ordering<K> keyOrdering = new Ordering<K>() { @Override public int compare(K left, K right) { return valueComparator.compare(map.get(left), map.get(right)); } }; return keyOrdering.immutableSortedCopy(map.keySet()); }
Example 10
Source File: TypeToken.java From codebuff with BSD 2-Clause "Simplified" License | 5 votes |
private static <K, V> ImmutableList<K> sortKeysByValue( final Map<K, V> map, final Comparator<? super V> valueComparator) { Ordering<K> keyOrdering = new Ordering<K>() { @Override public int compare(K left, K right) { return valueComparator.compare(map.get(left), map.get(right)); } }; return keyOrdering.immutableSortedCopy(map.keySet()); }