File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/internal Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change 11/*
22 * Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3- *
3+ *
44 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except
55 * in compliance with the License. A copy of the License is located at
6- *
6+ *
77 * http://aws.amazon.com/apache2.0
8- *
8+ *
99 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
1010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
1111 * specific language governing permissions and limitations under the License.
@@ -85,15 +85,16 @@ public int getMaxSize() {
8585 public void clear () {
8686 // The more complicated logic is to ensure that the listener is
8787 // actually called for all entries.
88- Set <Map .Entry <String , T >> entries = null ;
8988 if (listener != null ) {
90- entries = new HashSet <Map .Entry <String , T >>(map .entrySet ());
91- }
92- if ( listener != null && entries != null ) {
93- for ( final Map . Entry < String , T > e : entries ) {
94- listener . onRemoval ( e );
95- map . remove ( e . getKey ());
89+ Set < Map . Entry < String , T >> entries = new HashSet <Map .Entry <String , T >>(map .entrySet ());
90+ if ( entries != null ) {
91+ for ( final Map . Entry < String , T > e : entries ) {
92+ listener . onRemoval ( e );
93+ map . remove ( e . getKey () );
94+ }
9695 }
96+ } else {
97+ map .clear ();
9798 }
9899 }
99100
You can’t perform that action at this time.
0 commit comments