prompto.intrinsic.PromptoTuple Maven / Gradle / Ivy
The newest version!
package prompto.intrinsic;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@SuppressWarnings("serial")
public class PromptoTuple extends ArrayList {
boolean mutable;
public PromptoTuple(boolean mutable) {
this.mutable = mutable;
}
public PromptoTuple(Collection extends V> items, boolean mutable) {
super(items);
this.mutable = mutable;
}
public boolean isMutable() {
return mutable;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append('(');
forEach((i)->{
sb.append(i.toString());
sb.append(", ");
});
if(sb.length()>1)
sb.setLength(sb.length()-2); // trim last ", "
sb.append(')');
return sb.toString();
}
public Long getCount() {
return (long)size();
}
public long getNativeCount() {
return size();
}
public PromptoTuple slice(long first, long last) {
if (last < 0)
last = this.size() + 1 + last;
return new PromptoTuple<>(this.subList((int)(first-1), (int)last), false);
}
public boolean containsAny(Collection
© 2015 - 2024 Weber Informatics LLC | Privacy Policy