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) {
|
if (resource == null || this.list == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.contains(resource)) {
|
if (!this.contains(resource, true)) {
|
||||||
this.list.add(resource);
|
this.list.add(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,19 +115,18 @@ public class ResourceList {
|
|||||||
this.list.remove(resource);
|
this.list.remove(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(String resource) {
|
public boolean contains(String resource, boolean caseSensitive) {
|
||||||
if (resource == null || this.list == null) {
|
if (resource == null || this.list == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return this.list.contains(resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean containsCaseInsensitive(String resource) {
|
if (caseSensitive) {
|
||||||
if (resource == null || this.list == null) {
|
return this.list.contains(resource);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return this.list.stream().anyMatch(resource::equalsIgnoreCase);
|
return this.list.stream().anyMatch(resource::equalsIgnoreCase);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Utils */
|
/* Utils */
|
||||||
|
@ -92,11 +92,7 @@ public class ResourceListManager {
|
|||||||
if (list == null) {
|
if (list == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return list.contains(item, caseSensitive);
|
||||||
if (caseSensitive) {
|
|
||||||
return list.contains(item);
|
|
||||||
}
|
|
||||||
return list.containsCaseInsensitive(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveList(String category, String resourceName) {
|
public void saveList(String category, String resourceName) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user