Skip to content

Commit

Permalink
get only if exists, handle non existing item
Browse files Browse the repository at this point in the history
  • Loading branch information
firestar committed Dec 9, 2023
1 parent da18760 commit 930d935
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = 'com.nucleodb'
version = '1.13.11'
version = '1.13.12'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,16 @@ public Set<DataEntry> get(String key, Object value, DataEntryProjection dataEntr
dataEntryProjection = new DataEntryProjection();
}
if (key.equals("id")) {
if(this.keyToEntry.size()>0) {
Set<DataEntry> entrySet = new TreeSet(Arrays.asList(this.keyToEntry.get(value)));
Stream<DataEntry> process = dataEntryProjection.process(entrySet.stream());
if (dataEntryProjection.isWritable()) {
return process.map(de -> (DataEntry) de.copy(this.getConfig().getDataEntryClass())).collect(Collectors.toSet());
if(value !=null && this.keyToEntry.size()>0) {
DataEntry dataEntry = this.keyToEntry.get(value);
if(dataEntry!=null) {
Set<DataEntry> entrySet = new TreeSet(Arrays.asList(dataEntry));
Stream<DataEntry> process = dataEntryProjection.process(entrySet.stream());
if (dataEntryProjection.isWritable()) {
return process.map(de -> (DataEntry) de.copy(this.getConfig().getDataEntryClass())).collect(Collectors.toSet());
}
return process.collect(Collectors.toSet());
}
return process.collect(Collectors.toSet());
}
return new TreeSet<>();
}
Expand Down

0 comments on commit 930d935

Please sign in to comment.