15
15
16
16
package software .amazon .awssdk .enhanced .dynamodb .internal ;
17
17
18
+ import java .util .Collections ;
18
19
import java .util .List ;
19
20
import java .util .stream .Collectors ;
20
21
import software .amazon .awssdk .annotations .SdkInternalApi ;
@@ -33,19 +34,19 @@ public TableIndices(List<IndexMetadata> indices) {
33
34
}
34
35
35
36
public List <EnhancedLocalSecondaryIndex > localSecondaryIndices () {
36
- return indices .stream ()
37
- .filter (index -> !TableMetadata .primaryIndexName ().equals (index .name ()))
38
- .filter (index -> !index .partitionKey ().isPresent ())
39
- .map (TableIndices ::mapIndexMetadataToEnhancedLocalSecondaryIndex )
40
- .collect (Collectors .toList ());
37
+ return Collections . unmodifiableList ( indices .stream ()
38
+ .filter (index -> !TableMetadata .primaryIndexName ().equals (index .name ()))
39
+ .filter (index -> !index .partitionKey ().isPresent ())
40
+ .map (TableIndices ::mapIndexMetadataToEnhancedLocalSecondaryIndex )
41
+ .collect (Collectors .toList () ));
41
42
}
42
43
43
44
public List <EnhancedGlobalSecondaryIndex > globalSecondaryIndices () {
44
- return indices .stream ()
45
- .filter (index -> !TableMetadata .primaryIndexName ().equals (index .name ()))
46
- .filter (index -> index .partitionKey ().isPresent ())
47
- .map (TableIndices ::mapIndexMetadataToEnhancedGlobalSecondaryIndex )
48
- .collect (Collectors .toList ());
45
+ return Collections . unmodifiableList ( indices .stream ()
46
+ .filter (index -> !TableMetadata .primaryIndexName ().equals (index .name ()))
47
+ .filter (index -> index .partitionKey ().isPresent ())
48
+ .map (TableIndices ::mapIndexMetadataToEnhancedGlobalSecondaryIndex )
49
+ .collect (Collectors .toList () ));
49
50
}
50
51
51
52
private static EnhancedLocalSecondaryIndex mapIndexMetadataToEnhancedLocalSecondaryIndex (IndexMetadata indexMetadata ) {
0 commit comments