forked from Qortal/qortal
Small refactor of previous commit's code to improve consistency.
This commit is contained in:
parent
f2ff2187d9
commit
1f3d400ad6
@ -103,7 +103,7 @@ public class ResourceList {
|
||||
if (resource == null || this.list == null) {
|
||||
return;
|
||||
}
|
||||
if (!this.contains(resource)) {
|
||||
if (!this.contains(resource, true)) {
|
||||
this.list.add(resource);
|
||||
}
|
||||
}
|
||||
@ -115,18 +115,17 @@ public class ResourceList {
|
||||
this.list.remove(resource);
|
||||
}
|
||||
|
||||
public boolean contains(String resource) {
|
||||
public boolean contains(String resource, boolean caseSensitive) {
|
||||
if (resource == null || this.list == null) {
|
||||
return false;
|
||||
}
|
||||
return this.list.contains(resource);
|
||||
}
|
||||
|
||||
public boolean containsCaseInsensitive(String resource) {
|
||||
if (resource == null || this.list == null) {
|
||||
return false;
|
||||
if (caseSensitive) {
|
||||
return this.list.contains(resource);
|
||||
}
|
||||
else {
|
||||
return this.list.stream().anyMatch(resource::equalsIgnoreCase);
|
||||
}
|
||||
return this.list.stream().anyMatch(resource::equalsIgnoreCase);
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,11 +92,7 @@ public class ResourceListManager {
|
||||
if (list == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (caseSensitive) {
|
||||
return list.contains(item);
|
||||
}
|
||||
return list.containsCaseInsensitive(item);
|
||||
return list.contains(item, caseSensitive);
|
||||
}
|
||||
|
||||
public void saveList(String category, String resourceName) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user