Skip to content

Commit 879280f

Browse files
committed
IGNITE-26740 Refactor GridIntList: remove extra methods
1 parent 91df923 commit 879280f

File tree

4 files changed

+8
-66
lines changed

4 files changed

+8
-66
lines changed

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxImplicitSingleStateImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class IgniteTxImplicitSingleStateImpl extends IgniteTxLocalStateAdapter {
7373

7474
/** {@inheritDoc} */
7575
@Nullable @Override public GridIntList cacheIds() {
76-
return GridIntList.asList(cacheCtx.cacheId());
76+
return new GridIntList(new int[]{cacheCtx.cacheId()});
7777
}
7878

7979
/** {@inheritDoc} */

modules/core/src/main/java/org/apache/ignite/internal/processors/performancestatistics/FilePerformanceStatisticsWriter.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
3838
import org.apache.ignite.internal.processors.cache.persistence.wal.SegmentedRingByteBuffer;
3939
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
40-
import org.apache.ignite.internal.util.GridIntIterator;
4140
import org.apache.ignite.internal.util.GridIntList;
4241
import org.apache.ignite.internal.util.typedef.internal.U;
4342
import org.apache.ignite.internal.util.worker.GridWorker;
@@ -233,10 +232,8 @@ public void transaction(GridIntList cacheIds, long startTime, long duration, boo
233232
doWrite(commited ? TX_COMMIT : TX_ROLLBACK, transactionRecordSize(cacheIds.size()), buf -> {
234233
buf.putInt(cacheIds.size());
235234

236-
GridIntIterator iter = cacheIds.iterator();
237-
238-
while (iter.hasNext())
239-
buf.putInt(iter.next());
235+
for (int i = 0; i < cacheIds.size(); i++)
236+
buf.putInt(cacheIds.get(i));
240237

241238
buf.putLong(startTime);
242239
buf.putLong(duration);

modules/core/src/main/java/org/apache/ignite/internal/util/GridIntList.java

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.ObjectInput;
2323
import java.io.ObjectOutput;
2424
import java.util.Arrays;
25-
import org.apache.ignite.internal.util.typedef.F;
2625
import org.apache.ignite.internal.util.typedef.internal.S;
2726
import org.apache.ignite.internal.util.typedef.internal.SB;
2827

@@ -66,54 +65,13 @@ public GridIntList(int[] arr) {
6665
idx = arr.length;
6766
}
6867

69-
/**
70-
* @param vals Values.
71-
* @return List from values.
72-
*/
73-
public static GridIntList asList(int... vals) {
74-
if (F.isEmpty(vals))
75-
return new GridIntList();
76-
77-
return new GridIntList(vals);
78-
}
79-
80-
/**
81-
* @param arr Array.
82-
* @param size Size.
83-
*/
84-
private GridIntList(int[] arr, int size) {
85-
this.arr = arr;
86-
idx = size;
87-
}
88-
8968
/**
9069
* @return Array.
9170
*/
9271
public int[] array() {
9372
return arr;
9473
}
9574

96-
/**
97-
* @param arr New array.
98-
*/
99-
public void array(int[] arr) {
100-
this.arr = arr;
101-
}
102-
103-
/**
104-
* @return Index.
105-
*/
106-
public int idx() {
107-
return idx;
108-
}
109-
110-
/**
111-
* @param idx New index.
112-
*/
113-
public void idx(int idx) {
114-
this.idx = idx;
115-
}
116-
11775
/** {@inheritDoc} */
11876
@Override public boolean equals(Object o) {
11977
if (this == o)
@@ -319,21 +277,4 @@ public GridIntList sort() {
319277

320278
return this;
321279
}
322-
323-
/**
324-
* @return Iterator.
325-
*/
326-
public GridIntIterator iterator() {
327-
return new GridIntIterator() {
328-
int c;
329-
330-
@Override public boolean hasNext() {
331-
return c < idx;
332-
}
333-
334-
@Override public int next() {
335-
return arr[c++];
336-
}
337-
};
338-
}
339280
}

modules/core/src/test/java/org/apache/ignite/util/GridIntListSelfTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.apache.ignite.internal.util.GridIntList;
2121
import org.junit.Test;
2222

23-
import static org.apache.ignite.internal.util.GridIntList.asList;
2423
import static org.junit.Assert.assertEquals;
2524

2625
/**
@@ -97,4 +96,9 @@ public void testSort() {
9796
assertEquals(asList(1, 3, 4, 5, 0), list);
9897
assertEquals(asList(0, 1, 3, 4, 5), list.sort());
9998
}
99+
100+
/** */
101+
private static GridIntList asList(int... vals) {
102+
return new GridIntList(vals);
103+
}
100104
}

0 commit comments

Comments
 (0)