mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-07 08:16:31 +00:00
Cleanup
This commit is contained in:
@@ -23,7 +23,13 @@ import com.volmit.iris.util.json.JSONArray;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -55,6 +61,26 @@ public class KList<T> extends ArrayList<T> implements List<T> {
|
||||
add(e);
|
||||
}
|
||||
|
||||
public static KList<String> fromJSONAny(JSONArray oo) {
|
||||
KList<String> s = new KList<String>();
|
||||
|
||||
for (int i = 0; i < oo.length(); i++) {
|
||||
s.add(oo.get(i).toString());
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public static KList<String> asStringList(List<?> oo) {
|
||||
KList<String> s = new KList<String>();
|
||||
|
||||
for (Object i : oo) {
|
||||
s.add(i.toString());
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public int indexOfAddIfNeeded(T v) {
|
||||
addIfMissing(v);
|
||||
return indexOf(v);
|
||||
@@ -203,7 +229,6 @@ public class KList<T> extends ArrayList<T> implements List<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public KList<T> shuffle(Random rng) {
|
||||
Collections.shuffle(this, rng);
|
||||
return this;
|
||||
@@ -484,16 +509,6 @@ public class KList<T> extends ArrayList<T> implements List<T> {
|
||||
return remove(rng.i(0, last()));
|
||||
}
|
||||
|
||||
public static KList<String> fromJSONAny(JSONArray oo) {
|
||||
KList<String> s = new KList<String>();
|
||||
|
||||
for (int i = 0; i < oo.length(); i++) {
|
||||
s.add(oo.get(i).toString());
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public KList<T> sub(int f, int t) {
|
||||
KList<T> g = new KList<>();
|
||||
|
||||
@@ -514,16 +529,6 @@ public class KList<T> extends ArrayList<T> implements List<T> {
|
||||
return j;
|
||||
}
|
||||
|
||||
public static KList<String> asStringList(List<?> oo) {
|
||||
KList<String> s = new KList<String>();
|
||||
|
||||
for (Object i : oo) {
|
||||
s.add(i.toString());
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public KList<T> forceAdd(Object[] values) {
|
||||
for (Object i : values) {
|
||||
|
||||
Reference in New Issue
Block a user