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 1
1
/*
2
2
* Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- *
3
+ *
4
4
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except
5
5
* in compliance with the License. A copy of the License is located at
6
- *
6
+ *
7
7
* http://aws.amazon.com/apache2.0
8
- *
8
+ *
9
9
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS,
10
10
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11
11
* specific language governing permissions and limitations under the License.
@@ -85,15 +85,16 @@ public int getMaxSize() {
85
85
public void clear () {
86
86
// The more complicated logic is to ensure that the listener is
87
87
// actually called for all entries.
88
- Set <Map .Entry <String , T >> entries = null ;
89
88
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
+ }
96
95
}
96
+ } else {
97
+ map .clear ();
97
98
}
98
99
}
99
100
You can’t perform that action at this time.
0 commit comments