Skip to content

Commit df9e22a

Browse files
committed
chore: change to use java.util.Set to avoid duplication
Signed-off-by: Maximillian Arruda <[email protected]>
1 parent 8fa340c commit df9e22a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

jnosql-couchbase/src/main/java/org/eclipse/jnosql/databases/couchbase/communication/CouchbaseConfiguration.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import org.eclipse.jnosql.communication.Configurations;
1919
import org.eclipse.jnosql.communication.Settings;
2020

21-
import java.util.ArrayList;
22-
import java.util.List;
21+
import java.util.LinkedHashSet;
2322
import java.util.Objects;
23+
import java.util.Set;
2424
import java.util.stream.Stream;
2525

2626
import static java.util.Arrays.asList;
@@ -41,7 +41,7 @@ public abstract class CouchbaseConfiguration {
4141
protected String index;
4242

4343
protected String collection;
44-
protected List<String> collections = new ArrayList<>();
44+
protected Set<String> collections = new LinkedHashSet<>();
4545

4646

4747
protected void update(Settings settings) {
@@ -75,8 +75,8 @@ private String getIndex(Settings settings) {
7575
.map(Object::toString).orElse(null);
7676
}
7777

78-
private List<String> getCollections(Settings settings) {
79-
List<String> collections = new ArrayList<>();
78+
private Set<String> getCollections(Settings settings) {
79+
Set<String> collections = new LinkedHashSet<>();
8080
settings.get(CouchbaseConfigurations.COLLECTIONS)
8181
.map(Object::toString).stream()
8282
.flatMap(s -> Stream.of(s.split(",\\s*")))
@@ -159,7 +159,7 @@ public void addCollection(String collection) {
159159
*/
160160
public CouchbaseSettings toCouchbaseSettings() {
161161
return new CouchbaseSettings(this.host, this.user, this.password,
162-
this.scope, this.index, this.collection, this.collections);
162+
this.scope, this.index, this.collection, this.collections.stream().toList());
163163
}
164164

165165
@Override

0 commit comments

Comments
 (0)