Home
last modified time | relevance | path

Searched refs:comparator (Results 1 – 25 of 79) sorted by relevance

1234

/libcore/luni/src/test/java/libcore/java/util/
DComparatorTest.java48 private <T> void checkComparison(Comparator<T> comparator, List<T> items) { in checkComparison() argument
51 assertEquals(0, comparator.compare(a, a)); in checkComparison()
53 assertTrue(comparator.compare(a, b) < 0); in checkComparison()
54 assertTrue(comparator.compare(b, a) > 0); in checkComparison()
60 Comparator<Item> comparator = Comparator.comparingDouble(Item::getOrderAsDouble); in testComparingDouble() local
61 checkComparison(comparator, orderedItems); in testComparingDouble()
65 Comparator<Item> comparator = Comparator.comparingInt(Item::getOrderAsInt); in testComparingInt() local
66 checkComparison(comparator, orderedItems); in testComparingInt()
70 Comparator<Item> comparator = Comparator.comparingLong(Item::getOrderAsLong); in testComparingLong() local
71 checkComparison(comparator, orderedItems); in testComparingLong()
[all …]
DSpliteratorTester.java62 List<T> expectedElements, Comparator<T> comparator) { in runBasicIterationTests_unordered() argument
76 Collections.sort(expectedElements, comparator); in runBasicIterationTests_unordered()
77 Collections.sort(recorder, comparator); in runBasicIterationTests_unordered()
118 List<T> expectedElements, Comparator<T> comparator) { in runBasicSplitTests() argument
154 Collections.sort(expectedElements, comparator); in runBasicSplitTests()
155 Collections.sort(recorder, comparator); in runBasicSplitTests()
174 List<T> expectedElements, Comparator<T> comparator) { in runBasicSplitTests() argument
175 runBasicSplitTests(spliterable.spliterator(), expectedElements, comparator); in runBasicSplitTests() local
306 public static <T> void runSortedTests(Iterable<T> spliterable, Comparator<T> comparator) { in runSortedTests() argument
314 Collections.sort(sortedElements, comparator); in runSortedTests()
[all …]
/libcore/ojluni/src/main/java/java/util/function/
DBinaryOperator.java57 public static <T> BinaryOperator<T> minBy(Comparator<? super T> comparator) { in minBy() argument
58 Objects.requireNonNull(comparator); in minBy()
59 return (a, b) -> comparator.compare(a, b) <= 0 ? a : b; in minBy()
72 public static <T> BinaryOperator<T> maxBy(Comparator<? super T> comparator) { in maxBy() argument
73 Objects.requireNonNull(comparator); in maxBy()
74 return (a, b) -> comparator.compare(a, b) >= 0 ? a : b; in maxBy()
/libcore/ojluni/src/main/java/java/util/
DPriorityQueue.java122 private final Comparator<? super E> comparator; field in PriorityQueue
161 public PriorityQueue(Comparator<? super E> comparator) { in PriorityQueue() argument
162 this(DEFAULT_INITIAL_CAPACITY, comparator); in PriorityQueue()
177 Comparator<? super E> comparator) { in PriorityQueue() argument
183 this.comparator = comparator; in PriorityQueue()
205 this.comparator = (Comparator<? super E>) ss.comparator(); in PriorityQueue()
210 this.comparator = (Comparator<? super E>) pq.comparator(); in PriorityQueue()
214 this.comparator = null; in PriorityQueue()
234 this.comparator = (Comparator<? super E>) c.comparator(); in PriorityQueue()
252 this.comparator = (Comparator<? super E>) c.comparator(); in PriorityQueue()
[all …]
DArraysParallelSortHelpers.java119 Comparator<? super T> comparator; field in ArraysParallelSortHelpers.FJObject.Sorter
122 Comparator<? super T> comparator) { in Sorter() argument
126 this.comparator = comparator; in Sorter()
130 Comparator<? super T> c = this.comparator; in compute()
162 Comparator<? super T> comparator; field in ArraysParallelSortHelpers.FJObject.Merger
166 Comparator<? super T> comparator) { in Merger() argument
172 this.comparator = comparator; in Merger()
176 Comparator<? super T> c = this.comparator; in compute()
DTreeSet.java144 public TreeSet(Comparator<? super E> comparator) { in TreeSet() argument
145 this(new TreeMap<>(comparator)); in TreeSet()
175 this(s.comparator()); in TreeSet()
308 if (Objects.equals(set.comparator(), map.comparator())) { in addAll()
387 public Comparator<? super E> comparator() { in comparator() method in TreeSet
388 return m.comparator(); in comparator()
529 s.writeObject(m.comparator()); in writeObject()
DComparator.java381 public static <T> Comparator<T> nullsFirst(Comparator<? super T> comparator) { in nullsFirst() argument
382 return new Comparators.NullComparator<>(true, comparator); in nullsFirst()
402 public static <T> Comparator<T> nullsLast(Comparator<? super T> comparator) { in nullsLast() argument
403 return new Comparators.NullComparator<>(false, comparator); in nullsLast()
DSortedSet.java118 Comparator<? super E> comparator(); in comparator() method
260 return SortedSet.this.comparator(); in spliterator()
DReverseOrderSortedSetView.java43 comp = Collections.reverseOrder(set.comparator()); in ReverseOrderSortedSetView()
184 public Comparator<? super E> comparator() { in comparator() method in ReverseOrderSortedSetView
248 Comparator<E> c = (Comparator<E>) ReverseOrderSortedSetView.this.comparator(); in Subset()
330 public Comparator<? super E> comparator() { in comparator() method
331 return ReverseOrderSortedSetView.this.comparator(); in comparator()
/libcore/ojluni/src/main/java/java/util/stream/
DSortedOps.java62 Comparator<? super T> comparator) { in makeRef() argument
63 return new OfRef<>(upstream, comparator); in makeRef()
104 private final Comparator<? super T> comparator; field in SortedOps.OfRef
117 this.comparator = comp; in OfRef()
125 OfRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) { in OfRef() argument
129 this.comparator = Objects.requireNonNull(comparator); in OfRef()
141 return new SizedRefSortingSink<>(sink, comparator); in opWrapSink()
143 return new RefSortingSink<>(sink, comparator); in opWrapSink()
158 Arrays.parallelSort(flattenedData, comparator); in opEvaluateParallel()
305 protected final Comparator<? super T> comparator; field in SortedOps.AbstractRefSortingSink
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/
DPriorityQueueTest.java204 assertNull(queue.comparator()); in test_Constructor()
214 assertNull(queue.comparator()); in test_ConstructorI()
225 assertNull(queue.comparator()); in test_ConstructorILjava_util_Comparator()
227 MockComparator<Object> comparator = new MockComparator<Object>(); in test_ConstructorILjava_util_Comparator() local
228 queue = new PriorityQueue<Object>(100, comparator); in test_ConstructorILjava_util_Comparator()
231 assertEquals(comparator, queue.comparator()); in test_ConstructorILjava_util_Comparator()
262 assertEquals(objectComparator, integerQueue.comparator()); in test_ConstructorILjava_util_Comparator_cast()
278 assertNull(integerQueue.comparator()); in test_ConstructorLjava_util_Colleciton()
328 assertEquals(queue.comparator(), constructedQueue.comparator()); in test_ConstructorLjava_util_Colleciton_from_priorityqueue()
346 assertEquals(treeSet.comparator(), queue.comparator()); in test_ConstructorLjava_util_Colleciton_from_sortedset()
[all …]
DRefSortedMap.java88 private final Comparator<? super K> comparator; field in RefSortedMap
166 public Comparator<? super K> comparator() {
167 return RefSortedMap.this.comparator();
246 return comparator != null ? comparator.compare(start, end)
251 public RefSortedMap(Comparator<? super K> comparator) {
252 this.comparator = comparator;
262 this(map.comparator());
266 public Comparator<? super K> comparator() {
267 return comparator;
/libcore/ojluni/src/main/java/java/util/concurrent/
DConcurrentSkipListMap.java338 final Comparator<? super K> comparator; field in ConcurrentSkipListMap
507 Comparator<? super K> cmp = comparator; in findNode()
542 Comparator<? super K> cmp = comparator; in doGet()
599 Comparator<? super K> cmp = comparator; in doPut()
761 Comparator<? super K> cmp = comparator; in doRemove()
872 findPredecessor(k, comparator); // clean index in doRemoveFirstEntry()
990 findPredecessor(k, comparator); // clean index in doRemoveLastEntry()
1073 this.comparator = null; in ConcurrentSkipListMap()
1084 public ConcurrentSkipListMap(Comparator<? super K> comparator) { in ConcurrentSkipListMap() argument
1085 this.comparator = comparator; in ConcurrentSkipListMap()
[all …]
DPriorityBlockingQueue.java159 private transient Comparator<? super E> comparator; field in PriorityBlockingQueue
219 Comparator<? super E> comparator) { in PriorityBlockingQueue() argument
222 this.comparator = comparator; in PriorityBlockingQueue()
247 this.comparator = (Comparator<? super E>) ss.comparator(); in PriorityBlockingQueue()
253 this.comparator = (Comparator<? super E>) pq.comparator(); in PriorityBlockingQueue()
265 if (screen && (n == 1 || this.comparator != null)) { in PriorityBlockingQueue()
329 if ((cmp = comparator) == null) in dequeue()
433 if ((cmp = comparator) == null) in heapify()
477 if ((cmp = comparator) == null) in offer()
578 public Comparator<? super E> comparator() { in comparator() method in PriorityBlockingQueue
[all …]
DConcurrentSkipListSet.java125 public ConcurrentSkipListSet(Comparator<? super E> comparator) { in ConcurrentSkipListSet() argument
126 m = new ConcurrentSkipListMap<E,Object>(comparator); in ConcurrentSkipListSet()
154 m = new ConcurrentSkipListMap<E,Object>(s.comparator()); in ConcurrentSkipListSet()
388 public Comparator<? super E> comparator() { in comparator() method in ConcurrentSkipListSet
389 return m.comparator(); in comparator()
/libcore/ojluni/src/test/java/util/SequencedCollection/
DSimpleSortedMap.java39 public SimpleSortedMap(Comparator<? super K> comparator) { in SimpleSortedMap() argument
40 map = new TreeMap<>(comparator); in SimpleSortedMap()
113 public Comparator<? super K> comparator() { in comparator() method in SimpleSortedMap
114 return map.comparator(); in comparator()
DSimpleSortedSet.java44 public SimpleSortedSet(Comparator<? super E> comparator) { in SimpleSortedSet() argument
45 set = new TreeSet<>(comparator); in SimpleSortedSet()
118 public Comparator<? super E> comparator() { in comparator() method in SimpleSortedSet
119 return set.comparator(); in comparator()
/libcore/support/src/test/java/org/apache/harmony/testframework/serialization/
DSerializationTest.java319 public static void verifyGolden(Object test, Object object, SerializableAssert comparator) in verifyGolden() argument
321 assertNotNull("Null comparator", comparator); in verifyGolden()
323 comparator.assertDeserialized((Serializable) object, deserialized); in verifyGolden()
356 public static void verifyGolden(Object test, Object[] objects, SerializableAssert comparator) in verifyGolden() argument
361 comparator.assertDeserialized((Serializable) objects[i], deserialized); in verifyGolden()
386 public static void verifySelf(Object object, SerializableAssert comparator) throws Exception { in verifySelf() argument
388 comparator.assertDeserialized(initial, copySerializable(initial)); in verifySelf()
415 public static void verifySelf(Object[] objects, SerializableAssert comparator) in verifySelf() argument
419 verifySelf(entry, comparator); in verifySelf()
/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net/
DHttpRetryExceptionTest.java35 private static final SerializableAssert comparator = new SerializableAssert() { field in HttpRetryExceptionTest
53 LOCATION), comparator); in testSerializationSelf()
61 100, LOCATION), comparator); in testSerializationCompatibility()
/libcore/ojluni/src/test/java/util/Arrays/
DCorrect.java63 public void testComparatorSort(Comparator<Integer> comparator) { in testComparatorSort() argument
68 Arrays.sort(array1, array1.length/3, array1.length/2, comparator); in testComparatorSort()
69 stupidSort(array2, array2.length/3, array2.length/2, comparator); in testComparatorSort()
101 static void stupidSort(Integer[] a1, int from, int to, Comparator<Integer> comparator) { in stupidSort() argument
109 if (comparator.compare(a1[y], lowest) < 0) { in stupidSort()
DSortingHelper.java169 public void sort(Object[] a, Comparator comparator) { in sort() argument
298 public void sort(Object[] a, Comparator comparator) { in sort() argument
427 public void sort(Object[] a, Comparator comparator) { in sort() argument
483 public void sort(Object[] a, Comparator comparator) { in sort() argument
484 Arrays.sort(a, comparator); in sort()
540 public void sort(Object[] a, Comparator comparator) { in sort() argument
541 Arrays.parallelSort(a, comparator); in sort()
551 abstract public void sort(Object[] a, Comparator comparator); in sort() argument
/libcore/ojluni/src/test/java/util/Collections/
DEmptyNavigableSet.java104 if (null == set.comparator()) { in isDescending()
109 if (Collections.reverseOrder() == set.comparator()) { in isDescending()
114 …if (set.comparator().equals(Collections.reverseOrder(Collections.reverseOrder(set.comparator()))))… in isDescending()
127 Comparator comparator = navigableSet.comparator(); in testComparatorIsNull() local
129 …assertTrue(comparator == null || comparator == Collections.reverseOrder(), description + ": Compar… in testComparatorIsNull()
DEmptyNavigableMap.java97 if (null == set.comparator()) { in isDescending()
102 if (Collections.reverseOrder() == set.comparator()) { in isDescending()
107 …if (set.comparator().equals(Collections.reverseOrder(Collections.reverseOrder(set.comparator()))))… in isDescending()
120 Comparator comparator = navigableMap.comparator(); in testComparatorIsNull() local
122 …assertTrue(comparator == null || comparator == Collections.reverseOrder(), description + ": Compar… in testComparatorIsNull()
/libcore/ojluni/annotations/hiddenapi/java/util/
DPriorityQueue.java41 public PriorityQueue(java.util.Comparator<? super E> comparator) { in PriorityQueue() argument
45 public PriorityQueue(int initialCapacity, java.util.Comparator<? super E> comparator) { in PriorityQueue() argument
165 public java.util.Comparator<? super E> comparator() { in comparator() method in PriorityQueue
186 private final java.util.Comparator<? super E> comparator; field in PriorityQueue
189 comparator = null;
/libcore/luni/src/main/java/libcore/util/
DCollectionUtils.java85 public static <T> void removeDuplicates(List<T> list, Comparator<? super T> comparator) {
86 Collections.sort(list, comparator);
89 if (comparator.compare(list.get(j - 1), list.get(i)) != 0) {

1234