Skip to content

Commit ebcf77c

Browse files
committed
Modified LongArray
1 parent ac578f8 commit ebcf77c

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

src/main/java/js/base/Tools.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,6 @@ public static boolean mark(Object... msgs) {
11681168
public static void main(String[] args) {
11691169
pr("hello");
11701170
todo("!this has an exclamation mark");
1171-
var f = FileUtils.getUserDirectory();
1171+
FileUtils.getUserDirectory();
11721172
}
11731173
}

src/main/java/js/data/IntArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public final int indexOf(int value) {
158158
return i;
159159
return -1;
160160
}
161-
161+
162162
public final boolean isEmpty() {
163163
return size() == 0;
164164
}

src/main/java/js/data/LongArray.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public final String toString() {
6565
@Override
6666
public LongArray parse(Object object) {
6767
JSList source = (JSList) object;
68-
68+
6969
List<Number> sourceList = (List<Number>) source.wrappedList();
7070
long[] w = new long[sourceList.size()];
7171
for (int i = 0; i < w.length; i++)
@@ -112,6 +112,14 @@ public static LongArray with(long... longs) {
112112
return r;
113113
}
114114

115+
public final int indexOf(long value) {
116+
int size = size();
117+
for (int i = 0; i < size; i++)
118+
if (mArray[i] == value)
119+
return i;
120+
return -1;
121+
}
122+
115123
/**
116124
* Get contents as a primitive array
117125
*/
@@ -198,6 +206,14 @@ public Builder add(int position, int value) {
198206
return this;
199207
}
200208

209+
public Builder remove(int position) {
210+
if (position < 0 || position >= size())
211+
throw badArg("attempt to remove from position:", position, "; size", size());
212+
System.arraycopy(mArray, position + 1, mArray, position, size() - position);
213+
mUsed--;
214+
return this;
215+
}
216+
201217
public int size() {
202218
return mUsed;
203219
}

0 commit comments

Comments
 (0)