< prev index next > test/jdk/java/util/Spliterator/SpliteratorLateBindingTest.java
Print this page
/*
! * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
/*
! * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
import static org.testng.Assert.assertEquals;
/**
* @test
! * @bug 8148748 8170155
* @summary Spliterator last-binding tests
* @run testng SpliteratorLateBindingTest
*/
@Test
import static org.testng.Assert.assertEquals;
/**
* @test
! * @bug 8148748 8170155 8336672
* @summary Spliterator last-binding tests
* @run testng SpliteratorLateBindingTest
*/
@Test
if (spliteratorDataProvider != null) {
return spliteratorDataProvider;
}
List<Object[]> data = new ArrayList<>();
! SpliteratorDataBuilder<Integer> db =
! new SpliteratorDataBuilder<>(data, 5, Arrays.asList(1, 2, 3, 4));
// Collections
db.addList(ArrayList::new);
if (spliteratorDataProvider != null) {
return spliteratorDataProvider;
}
List<Object[]> data = new ArrayList<>();
! SpliteratorDataBuilder<String> db =
! new SpliteratorDataBuilder<>(data, "Z", Arrays.asList("A", "B", "C", "D"));
// Collections
db.addList(ArrayList::new);
db.addCollection(LinkedHashSet::new);
db.addCollection(TreeSet::new);
db.addCollection(c -> {
! Stack<Integer> s = new Stack<>();
s.addAll(c);
return s;
});
db.addCollection(PriorityQueue::new);
db.addCollection(LinkedHashSet::new);
db.addCollection(TreeSet::new);
db.addCollection(c -> {
! Stack<String> s = new Stack<>();
s.addAll(c);
return s;
});
db.addCollection(PriorityQueue::new);
db.addMap(LinkedHashMap::new);
db.addMap(IdentityHashMap::new);
+ // BUG: Assumes identity
db.addMap(WeakHashMap::new);
// @@@ Descending maps etc
db.addMap(TreeMap::new);
// BitSet
+ // BUG: Assumes identity in WeakHashMap
List<Integer> bits = List.of(0, 1, 2);
Function<BitSet, Spliterator.OfInt> bitsSource = bs -> bs.stream().spliterator();
db.add("new BitSet.stream().spliterator() ADD",
() -> new IntSource<>(toBitSet(bits), bitsSource, bs -> bs.set(3)));
db.add("new BitSet.stream().spliterator() REMOVE",
< prev index next >