@@ -55,10 +55,13 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
55
55
56
56
private final Locale locale ;
57
57
58
+ @ Nullable
58
59
private transient Set <String > keySet ;
59
60
61
+ @ Nullable
60
62
private transient Collection <V > values ;
61
63
64
+ @ Nullable
62
65
private transient Set <Entry <String , V >> entrySet ;
63
66
64
67
@@ -320,6 +323,7 @@ protected boolean removeEldestEntry(Map.Entry<String, V> eldest) {
320
323
return false ;
321
324
}
322
325
326
+ @ Nullable
323
327
private String removeCaseInsensitiveKey (String key ) {
324
328
return this .caseInsensitiveKeys .remove (convertKey (key ));
325
329
}
@@ -329,12 +333,10 @@ private class KeySet extends AbstractSet<String> {
329
333
330
334
private final Set <String > delegate ;
331
335
332
-
333
336
KeySet (Set <String > delegate ) {
334
337
this .delegate = delegate ;
335
338
}
336
339
337
-
338
340
@ Override
339
341
public int size () {
340
342
return this .delegate .size ();
@@ -369,20 +371,17 @@ public Spliterator<String> spliterator() {
369
371
public void forEach (Consumer <? super String > action ) {
370
372
this .delegate .forEach (action );
371
373
}
372
-
373
374
}
374
375
375
376
376
377
private class Values extends AbstractCollection <V > {
377
378
378
379
private final Collection <V > delegate ;
379
380
380
-
381
381
Values (Collection <V > delegate ) {
382
382
this .delegate = delegate ;
383
383
}
384
384
385
-
386
385
@ Override
387
386
public int size () {
388
387
return this .delegate .size ();
@@ -412,20 +411,17 @@ public Spliterator<V> spliterator() {
412
411
public void forEach (Consumer <? super V > action ) {
413
412
this .delegate .forEach (action );
414
413
}
415
-
416
414
}
417
415
418
416
419
417
private class EntrySet extends AbstractSet <Entry <String , V >> {
420
418
421
419
private final Set <Entry <String , V >> delegate ;
422
420
423
-
424
421
public EntrySet (Set <Entry <String , V >> delegate ) {
425
422
this .delegate = delegate ;
426
423
}
427
424
428
-
429
425
@ Override
430
426
public int size () {
431
427
return this .delegate .size ();
@@ -441,7 +437,6 @@ public Iterator<Entry<String, V>> iterator() {
441
437
return new EntrySetIterator ();
442
438
}
443
439
444
-
445
440
@ Override
446
441
@ SuppressWarnings ("unchecked" )
447
442
public boolean remove (Object o ) {
@@ -452,7 +447,6 @@ public boolean remove(Object o) {
452
447
return false ;
453
448
}
454
449
455
-
456
450
@ Override
457
451
public void clear () {
458
452
this .delegate .clear ();
@@ -468,14 +462,14 @@ public Spliterator<Entry<String, V>> spliterator() {
468
462
public void forEach (Consumer <? super Entry <String , V >> action ) {
469
463
this .delegate .forEach (action );
470
464
}
471
-
472
465
}
473
466
474
467
475
468
private class EntryIterator {
476
469
477
470
private final Iterator <Entry <String , V >> delegate ;
478
471
472
+ @ Nullable
479
473
private Entry <String , V > last ;
480
474
481
475
public EntryIterator () {
@@ -494,12 +488,11 @@ public boolean hasNext() {
494
488
495
489
public void remove () {
496
490
this .delegate .remove ();
497
- if (this .last != null ) {
491
+ if (this .last != null ) {
498
492
removeCaseInsensitiveKey (this .last .getKey ());
499
493
this .last = null ;
500
494
}
501
495
}
502
-
503
496
}
504
497
505
498
@@ -509,7 +502,6 @@ private class KeySetIterator extends EntryIterator implements Iterator<String> {
509
502
public String next () {
510
503
return nextEntry ().getKey ();
511
504
}
512
-
513
505
}
514
506
515
507
@@ -519,7 +511,6 @@ private class ValuesIterator extends EntryIterator implements Iterator<V> {
519
511
public V next () {
520
512
return nextEntry ().getValue ();
521
513
}
522
-
523
514
}
524
515
525
516
@@ -529,7 +520,6 @@ private class EntrySetIterator extends EntryIterator implements Iterator<Entry<S
529
520
public Entry <String , V > next () {
530
521
return nextEntry ();
531
522
}
532
-
533
523
}
534
524
535
525
}
0 commit comments