88import java .util .Collection ;
99import java .util .HashMap ;
1010import java .util .HashSet ;
11+ import java .util .LinkedHashMap ;
12+ import java .util .LinkedHashSet ;
1113import java .util .LinkedList ;
1214import java .util .List ;
1315import java .util .Map ;
1416import java .util .Random ;
1517import java .util .Set ;
1618import java .util .TreeMap ;
1719import java .util .TreeSet ;
20+ import java .util .concurrent .ConcurrentHashMap ;
21+ import java .util .concurrent .ConcurrentMap ;
1822import java .util .function .LongFunction ;
1923import java .util .stream .Stream ;
2024
@@ -31,10 +35,14 @@ public class SizeLessThanValueSource implements ValueSource {
3135 TYPE_SOURCES .put (LinkedList .class , SizeLessThanValueSource ::getLinkedListStream );
3236 TYPE_SOURCES .put (Set .class , SizeLessThanValueSource ::getHashSetStream );
3337 TYPE_SOURCES .put (HashSet .class , SizeLessThanValueSource ::getHashSetStream );
38+ TYPE_SOURCES .put (LinkedHashSet .class , SizeLessThanValueSource ::getLinkedHashSetStream );
3439 TYPE_SOURCES .put (TreeSet .class , SizeLessThanValueSource ::getTreeSetStream );
3540 TYPE_SOURCES .put (Map .class , SizeLessThanValueSource ::getHashMapStream );
3641 TYPE_SOURCES .put (HashMap .class , SizeLessThanValueSource ::getHashMapStream );
42+ TYPE_SOURCES .put (LinkedHashMap .class , SizeLessThanValueSource ::getLinkedHashMapStream );
3743 TYPE_SOURCES .put (TreeMap .class , SizeLessThanValueSource ::getTreeMapStream );
44+ TYPE_SOURCES .put (ConcurrentMap .class , SizeLessThanValueSource ::getConcurrentHashMapStream );
45+ TYPE_SOURCES .put (ConcurrentHashMap .class , SizeLessThanValueSource ::getConcurrentHashMapStream );
3846 }
3947
4048 @ SuppressWarnings ("unused" )
@@ -123,6 +131,18 @@ private static Stream<Collection<?>> getHashSetStream(long value) {
123131 );
124132 }
125133
134+ @ NonNull
135+ private static Stream <Collection <?>> getLinkedHashSetStream (long value ) {
136+ return Stream .concat (
137+ Stream .of (new LinkedHashSet <>()),
138+ Stream .iterate (1L , i -> i < value , i -> i + 1 )
139+ .map (size -> generateCollection (
140+ Math .toIntExact (size ),
141+ new LinkedHashSet <>()
142+ ))
143+ );
144+ }
145+
126146 @ NonNull
127147 private static Stream <Collection <?>> getTreeSetStream (long value ) {
128148 return Stream .concat (
@@ -147,6 +167,18 @@ private static Stream<Collection<?>> getTreeSetStream(long value) {
147167 );
148168 }
149169
170+ @ NonNull
171+ private static Stream <Map <?, ?>> getLinkedHashMapStream (long value ) {
172+ return Stream .concat (
173+ Stream .of (new LinkedHashMap <>()),
174+ Stream .iterate (1L , i -> i < value , i -> i + 1 )
175+ .map (size -> generateMap (
176+ Math .toIntExact (size ),
177+ new LinkedHashMap <>()
178+ ))
179+ );
180+ }
181+
150182 @ NonNull
151183 private static Stream <Map <?, ?>> getTreeMapStream (long value ) {
152184 return Stream .concat (
@@ -159,6 +191,18 @@ private static Stream<Collection<?>> getTreeSetStream(long value) {
159191 );
160192 }
161193
194+ @ NonNull
195+ private static Stream <Map <?, ?>> getConcurrentHashMapStream (long value ) {
196+ return Stream .concat (
197+ Stream .of (new ConcurrentHashMap <>()),
198+ Stream .iterate (1L , i -> i < value , i -> i + 1 )
199+ .map (size -> generateMap (
200+ Math .toIntExact (size ),
201+ new ConcurrentHashMap <>()
202+ ))
203+ );
204+ }
205+
162206 private static String generateRandomString (int length ) {
163207 // Include printable ASCII characters (32-126) which includes space and common characters
164208 return RANDOM .ints (length , 32 , 127 )
0 commit comments