Home
last modified time | relevance | path

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

12

/libcore/luni/src/test/java/libcore/java/util/
DComparatorTest.java43 private <T> void checkComparison(Comparator<T> comparator, T[] items) { in checkComparison() argument
45 assertEquals(0, comparator.compare(items[i], items[i])); in checkComparison()
47 assertTrue(comparator.compare(items[i], items[j]) < 0); in checkComparison()
48 assertTrue(comparator.compare(items[j], items[i]) > 0); in checkComparison()
54 Comparator<Item> comparator = Comparator.comparingDouble(Item::getOrderAsDouble); in testComparingDouble() local
55 checkComparison(comparator, orderedItems); in testComparingDouble()
59 Comparator<Item> comparator = Comparator.comparingInt(Item::getOrderAsInt); in testComparingInt() local
60 checkComparison(comparator, orderedItems); in testComparingInt()
64 Comparator<Item> comparator = Comparator.comparingLong(Item::getOrderAsLong); in testComparingLong() local
65 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 …]
DTreeSetTest.java44 assertEquals(0, deserialized.comparator().compare("X", "x")); in testSerializationWithComparator()
132 assertEquals(0, deserialized.comparator().compare("X", "x")); in testJava5SerializationWithComparator()
/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.java108 private final Comparator<? super E> comparator; field in PriorityQueue
147 public PriorityQueue(Comparator<? super E> comparator) { in PriorityQueue() argument
148 this(DEFAULT_INITIAL_CAPACITY, comparator); in PriorityQueue()
163 Comparator<? super E> comparator) { in PriorityQueue() argument
169 this.comparator = comparator; in PriorityQueue()
192 this.comparator = (Comparator<? super E>) ss.comparator(); in PriorityQueue()
197 this.comparator = (Comparator<? super E>) pq.comparator(); in PriorityQueue()
201 this.comparator = null; in PriorityQueue()
222 this.comparator = (Comparator<? super E>) c.comparator(); in PriorityQueue()
241 this.comparator = (Comparator<? super E>) c.comparator(); in PriorityQueue()
[all …]
DTreeSet.java140 public TreeSet(Comparator<? super E> comparator) { in TreeSet() argument
141 this(new TreeMap<>(comparator)); in TreeSet()
171 this(s.comparator()); in TreeSet()
305 Comparator<?> cc = set.comparator(); in addAll()
306 Comparator<? super E> mc = map.comparator(); in addAll()
386 public Comparator<? super E> comparator() { in comparator() method in TreeSet
387 return m.comparator(); in comparator()
503 s.writeObject(m.comparator()); in writeObject()
DSortedSet.java118 Comparator<? super E> comparator(); in comparator() method
260 return SortedSet.this.comparator(); in spliterator()
DComparator.java377 public static <T> Comparator<T> nullsFirst(Comparator<? super T> comparator) { in nullsFirst() argument
378 return new Comparators.NullComparator<>(true, comparator); in nullsFirst()
398 public static <T> Comparator<T> nullsLast(Comparator<? super T> comparator) { in nullsLast() argument
399 return new Comparators.NullComparator<>(false, comparator); in nullsLast()
DTreeMap.java122 private final Comparator<? super K> comparator; field in TreeMap
149 comparator = null; in TreeMap()
166 public TreeMap(Comparator<? super K> comparator) { in TreeMap() argument
167 this.comparator = comparator; in TreeMap()
185 comparator = null; in TreeMap()
199 comparator = m.comparator(); in TreeMap()
283 public Comparator<? super K> comparator() { in comparator() method in TreeMap
284 return comparator; in comparator()
316 Comparator<?> c = ((SortedMap<?,?>)map).comparator(); in putAll()
317 if (c == comparator || (c != null && c.equals(comparator))) { in putAll()
[all …]
DSortedMap.java123 Comparator<? super K> comparator(); in comparator() method
/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 …]
DStream.java389 Stream<T> sorted(Comparator<? super T> comparator); in sorted() argument
820 Optional<T> min(Comparator<? super T> comparator); in min() argument
837 Optional<T> max(Comparator<? super T> comparator); in max() argument
DReferencePipeline.java394 public final Stream<P_OUT> sorted(Comparator<? super P_OUT> comparator) {
395 return SortedOps.makeRef(this, comparator);
516 public final Optional<P_OUT> max(Comparator<? super P_OUT> comparator) {
517 return reduce(BinaryOperator.maxBy(comparator));
521 public final Optional<P_OUT> min(Comparator<? super P_OUT> comparator) {
522 return reduce(BinaryOperator.minBy(comparator));
/libcore/ojluni/src/main/java/java/util/concurrent/
DPriorityBlockingQueue.java161 private transient Comparator<? super E> comparator; field in PriorityBlockingQueue
220 Comparator<? super E> comparator) { in PriorityBlockingQueue() argument
225 this.comparator = comparator; in PriorityBlockingQueue()
252 this.comparator = (Comparator<? super E>) ss.comparator(); in PriorityBlockingQueue()
258 this.comparator = (Comparator<? super E>) pq.comparator(); in PriorityBlockingQueue()
268 if (screen && (n == 1 || this.comparator != null)) { in PriorityBlockingQueue()
330 Comparator<? super E> cmp = comparator; in dequeue()
440 Comparator<? super E> cmp = comparator; in heapify()
486 Comparator<? super E> cmp = comparator; in offer()
588 public Comparator<? super E> comparator() { in comparator() method in PriorityBlockingQueue
[all …]
DConcurrentSkipListMap.java375 final Comparator<? super K> comparator; field in ConcurrentSkipListMap
738 Comparator<? super K> cmp = comparator; in findNode()
774 Comparator<? super K> cmp = comparator; in doGet()
816 Comparator<? super K> cmp = comparator; in doPut()
953 Comparator<? super K> cmp = comparator; in doRemove()
1125 findPredecessor(key, comparator); in doRemoveLastEntry()
1261 Comparator<? super K> cmp = comparator; in getNear()
1279 this.comparator = null; in ConcurrentSkipListMap()
1291 public ConcurrentSkipListMap(Comparator<? super K> comparator) { in ConcurrentSkipListMap() argument
1292 this.comparator = comparator; in ConcurrentSkipListMap()
[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()
390 public Comparator<? super E> comparator() { in comparator() method in ConcurrentSkipListSet
391 return m.comparator(); in comparator()
/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/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/
DPriorityQueueTest.java201 assertNull(queue.comparator()); in test_Constructor()
211 assertNull(queue.comparator()); in test_ConstructorI()
222 assertNull(queue.comparator()); in test_ConstructorILjava_util_Comparator()
224 MockComparator<Object> comparator = new MockComparator<Object>(); in test_ConstructorILjava_util_Comparator() local
225 queue = new PriorityQueue<Object>(100, comparator); in test_ConstructorILjava_util_Comparator()
228 assertEquals(comparator, queue.comparator()); in test_ConstructorILjava_util_Comparator()
259 assertEquals(objectComparator, integerQueue.comparator()); in test_ConstructorILjava_util_Comparator_cast()
275 assertNull(integerQueue.comparator()); in test_ConstructorLjava_util_Colleciton()
325 assertEquals(queue.comparator(), constructedQueue.comparator()); in test_ConstructorLjava_util_Colleciton_from_priorityqueue()
343 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;
DSortedMapTestBase.java183 assertEquals(ref.comparator(), map.comparator()); in testComparator()
208 if (ref.comparator() != null && in testSubMap()
209 ref.comparator().compare(key0, key1) > 0) { in testSubMap()
219 if (ref.comparator() != null && ref.comparator().compare(100, 0) < 0) { in testSubMap()
DRandomTest.java312 SerializationTest.verifyGolden(this, rand, comparator); in testSerializationCompatibility()
316 SerializationTest.verifySelf(rand, comparator); in testSerializationCompatibility()
319 public static final SerializationTest.SerializableAssert comparator = field in RandomTest
DHashSetTest.java218 SerializationTest.verifySelf(hs, comparator); in test_Serialization()
219 SerializationTest.verifyGolden(this, hs, comparator); in test_Serialization()
308 private static final SerializationTest.SerializableAssert comparator = new field in HashSetTest
/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/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) {
/libcore/ojluni/src/main/java/java/net/
DInMemoryCookieStore.java309 T comparator) in getInternal2() argument
313 if ((index == comparator) || (index != null && comparator.compareTo(index) == 0)) { in getInternal2()

12