{
LOCK.writeLock().lock();
- Iterator<int[]> it = hiddenColumns.iterator();
- while (it.hasNext())
+ for (int[] region : hiddenColumns)
{
- int[] region = it.next();
for (int j = region[0]; j < region[1] + 1; j++)
{
sel.addElement(j);
// insert gaps corresponding to each hidden region but where each hidden
// column region is shifted backwards by the number of preceding visible
// gaps update hidden columns at the same time
- Iterator<int[]> regions = hiddenColumns.iterator();
List<int[]> newhidden = new ArrayList<>();
int numGapsBefore = 0;
int gapPosition = 0;
- while (regions.hasNext())
+ for (int[] region : hiddenColumns)
{
// get region coordinates accounting for gaps
// we can rely on gaps not being *in* hidden regions because we already
// removed those
- int[] region = regions.next();
while (gapPosition < region[0])
{
gapPosition++;
LOCK.readLock().lock();
StringBuilder regionBuilder = new StringBuilder();
- Iterator<int[]> it = hiddenColumns.iterator();
- while (it.hasNext())
+ boolean first = true;
+ for (int[] range : hiddenColumns)
{
- int[] range = it.next();
- regionBuilder.append(delimiter).append(range[0]).append(between)
- .append(range[1]);
- if (!it.hasNext())
+ if (!first)
{
- regionBuilder.deleteCharAt(0);
+ regionBuilder.append(delimiter);
}
+ else
+ {
+ first = false;
+ }
+ regionBuilder.append(range[0]).append(between).append(range[1]);
+
}
return regionBuilder.toString();
// numColumns is out of date, so recalculate
int size = 0;
- Iterator<int[]> it = hiddenColumns.iterator();
- while (it.hasNext())
+ for (int[] range : hiddenColumns)
{
- int[] range = it.next();
size += range[1] - range[0] + 1;
}
return false;
}
- Iterator<int[]> it = hiddenColumns.iterator();
Iterator<int[]> thatit = that.iterator();
- while (it.hasNext())
+ for (int[] thisRange : hiddenColumns)
{
- int[] thisRange = it.next();
int[] thatRange = thatit.next();
if (thisRange[0] != thatRange[0] || thisRange[1] != thatRange[1])
{
{
LOCK.readLock().lock();
int hashCode = 1;
- Iterator<int[]> it = hiddenColumns.iterator();
- while (it.hasNext())
+ for (int[] hidden : hiddenColumns)
{
- int[] hidden = it.next();
hashCode = HASH_MULTIPLIER * hashCode + hidden[0];
hashCode = HASH_MULTIPLIER * hashCode + hidden[1];
}
{
LOCK.readLock().lock();
- Iterator<int[]> it = hiddenColumns.iterator();
- while (it.hasNext())
+ for (int[] range : hiddenColumns)
{
- int[] range = it.next();
inserts.set(range[0], range[1] + 1);
}
} finally
return new int[] { startPos, endPos };
}
- Iterator<int[]> it = hiddenColumns.iterator();
- while (it.hasNext())
+ for (int[] range : hiddenColumns)
{
- int[] range = it.next();
lowestRange = (range[0] <= startPos) ? range : lowestRange;
higestRange = (range[1] >= endPos) ? range : higestRange;
}