JavaCAD
FloatArrayList.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2014, Oracle and/or its affiliates.
3  * All rights reserved. Use is subject to license terms.
4  *
5  * This file is available and licensed under the following license:
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * - Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * - Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the distribution.
16  * - Neither the name of Oracle Corporation nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 package eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj;
33 
34 
35 import java.util.AbstractList;
36 import java.util.Arrays;
37 import java.util.Collection;
38 import java.util.Collections;
39 import java.util.ConcurrentModificationException;
40 import java.util.Iterator;
41 import java.util.LinkedList;
42 import java.util.List;
43 import java.util.ListIterator;
44 import java.util.NoSuchElementException;
45 import java.util.RandomAccess;
46 import java.util.Vector;
47 
48 
49 // TODO: Auto-generated Javadoc
103 public class FloatArrayList extends AbstractList<Float>
104  implements List<Float>, RandomAccess, Cloneable, java.io.Serializable {
105 
110  private transient float[] elementData;
111 
117  private int size;
118 
125  public FloatArrayList(int initialCapacity) {
126  super();
127  if (initialCapacity < 0) {
128  throw new IllegalArgumentException(
129  "Illegal Capacity: " +
130  initialCapacity);
131  }
132  this.elementData = new float[initialCapacity];
133  }
134 
136  public FloatArrayList() {
137  this(10);
138  }
139 
147  public FloatArrayList(Collection<? extends Float> c) {
148  elementData = new float[c.size()];
149  int i = 0;
150  for (Float d : c) {
151  elementData[i] = d;
152  i++;
153  }
154  size = elementData.length;
155  }
156 
161  public void trimToSize() {
162  modCount++;
163  int oldCapacity = elementData.length;
164  if (size < oldCapacity) {
165  elementData = Arrays.copyOf(elementData, size);
166  }
167  }
168 
175  public void ensureCapacity(int minCapacity) {
176  if (minCapacity > 0) {
177  ensureCapacityInternal(minCapacity);
178  }
179  }
180 
186  private void ensureCapacityInternal(int minCapacity) {
187  modCount++;
188  // overflow-conscious code
189  if (minCapacity - elementData.length > 0) {
190  grow(minCapacity);
191  }
192  }
193 
198  private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
199 
206  private void grow(int minCapacity) {
207  // overflow-conscious code
208  int oldCapacity = elementData.length;
209  int newCapacity = oldCapacity + (oldCapacity >> 1);
210  if (newCapacity - minCapacity < 0)
211  newCapacity = minCapacity;
212  if (newCapacity - MAX_ARRAY_SIZE > 0)
213  newCapacity = hugeCapacity(minCapacity);
214  // minCapacity is usually close to size, so this is a win:
215  elementData = Arrays.copyOf(elementData, newCapacity);
216  }
217 
224  private static int hugeCapacity(int minCapacity) {
225  if (minCapacity < 0) // overflow
226  throw new OutOfMemoryError();
227  return (minCapacity > MAX_ARRAY_SIZE) ?
228  Integer.MAX_VALUE :
230  }
231 
237  @Override public int size() {
238  return size;
239  }
240 
246  @Override public boolean isEmpty() {
247  return size == 0;
248  }
249 
257  @Override public boolean contains(Object o) {
258  return indexOf(o) >= 0;
259  }
260 
269  @Override public int indexOf(Object o) {
270  if (o instanceof Float) {
271  for (int i = 0; i < size; i++) {
272  if (o.equals(elementData[i])) {
273  return i;
274  }
275  }
276  }
277  return -1;
278  }
279 
288  @Override public int lastIndexOf(Object o) {
289  if (o instanceof Float) {
290  for (int i = size - 1; i >= 0; i--)
291  if (o.equals(elementData[i]))
292  return i;
293  }
294  return -1;
295  }
296 
302  @Override public Object clone() {
303  try {
304  @SuppressWarnings("unchecked")
305  FloatArrayList v = (FloatArrayList) super.clone();
306  v.elementData = Arrays.copyOf(elementData, size);
307  v.modCount = 0;
308  return v;
309  } catch (CloneNotSupportedException e) {
310  // this shouldn't happen, since we are Cloneable
311  throw new InternalError();
312  }
313  }
314 
324  @Override public Object[] toArray() {
325  Float[] array = new Float[size];
326  for (int i = 0; i < size; i++) {
327  array[i] = elementData[i];
328  }
329  return array;
330  }
331 
350  @SuppressWarnings("unchecked")
351  @Override public <T> T[] toArray(T[] a) {
352  if (a.length < size) {
353  // Make a new array of a's runtime type, but my contents:
354  return (T[]) Arrays.copyOf(toArray(), size, a.getClass());
355  }
356  System.arraycopy(elementData, 0, a, 0, size);
357  if (a.length > size)
358  a[size] = null;
359  return a;
360  }
361 
367  public float[] toFloatArray() {
368  float[] res = new float[size];
369  System.arraycopy(elementData, 0, res, 0, size);
370  return res;
371  }
372 
373  // Positional Access Operations
374 
381  @SuppressWarnings("unchecked") Float elementData(int index) {
382  return (Float) elementData[index];
383  }
384 
392  @Override public Float get(int index) {
393  rangeCheck(index);
394 
395  return elementData(index);
396  }
397 
406  @Override public Float set(int index, Float element) {
407  rangeCheck(index);
408 
409  Float oldValue = elementData(index);
410  elementData[index] = element;
411  return oldValue;
412  }
413 
420  @Override public boolean add(Float e) {
421  ensureCapacityInternal(size + 1); // Increments modCount!!
422  elementData[size++] = e;
423  return true;
424  }
425 
434  @Override public void add(int index, Float element) {
435  rangeCheckForAdd(index);
436 
437  ensureCapacityInternal(size + 1); // Increments modCount!!
438  System.arraycopy(
439  elementData, index, elementData, index + 1,
440  size - index);
441  elementData[index] = element;
442  size++;
443  }
444 
453  @Override public Float remove(int index) {
454  rangeCheck(index);
455 
456  modCount++;
457  Float oldValue = elementData(index);
458 
459  int numMoved = size - index - 1;
460  if (numMoved > 0)
461  System.arraycopy(
462  elementData, index + 1, elementData, index,
463  numMoved);
464  elementData[--size] = 0; // Forget the item completely
465 
466  return oldValue;
467  }
468 
479  @Override public boolean remove(Object o) {
480  if (o instanceof Float) {
481  for (int index = 0; index < size; index++)
482  if (o.equals(elementData[index])) {
483  fastRemove(index);
484  return true;
485  }
486  }
487  return false;
488  }
489 
495  /*
496  * Private remove method that skips bounds checking and does not
497  * return the value removed.
498  */
499  private void fastRemove(int index) {
500  modCount++;
501  int numMoved = size - index - 1;
502  if (numMoved > 0)
503  System.arraycopy(
504  elementData, index + 1, elementData, index,
505  numMoved);
506  elementData[--size] = 0; // Forget the item completely
507  }
508 
510  @Override public void clear() {
511  modCount++;
512 
513  // Forget the items completely
514  for (int i = 0; i < size; i++)
515  elementData[i] = 0;
516 
517  size = 0;
518  }
519 
530  @Override public boolean addAll(Collection<? extends Float> c) {
531  Object[] a = c.toArray();
532  int numNew = a.length;
533  ensureCapacityInternal(size + numNew); // Increments modCount
534  System.arraycopy(a, 0, elementData, size, numNew);
535  size += numNew;
536  return numNew != 0;
537  }
538 
551  @Override public boolean addAll(int index, Collection<? extends Float> c) {
552  rangeCheckForAdd(index);
553 
554  Object[] a = c.toArray();
555  int numNew = a.length;
556  ensureCapacityInternal(size + numNew); // Increments modCount
557 
558  int numMoved = size - index;
559  if (numMoved > 0)
560  System.arraycopy(
561  elementData, index, elementData, index + numNew,
562  numMoved);
563 
564  System.arraycopy(a, 0, elementData, index, numNew);
565  size += numNew;
566  return numNew != 0;
567  }
568 
579  @Override protected void removeRange(int fromIndex, int toIndex) {
580  modCount++;
581  int numMoved = size - toIndex;
582  System.arraycopy(
583  elementData, toIndex, elementData, fromIndex,
584  numMoved);
585 
586  // Forget the item completely
587  int newSize = size - (toIndex - fromIndex);
588  while (size != newSize)
589  elementData[--size] = 0;
590  }
591 
599  private void rangeCheck(int index) {
600  if (index >= size)
601  throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
602  }
603 
609  private void rangeCheckForAdd(int index) {
610  if (index > size || index < 0)
611  throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
612  }
613 
621  private String outOfBoundsMsg(int index) {
622  return "Index: " + index + ", Size: " + size;
623  }
624 
637  @Override public boolean removeAll(Collection<?> c) {
638  return batchRemove(c, false);
639  }
640 
654  @Override public boolean retainAll(Collection<?> c) {
655  return batchRemove(c, true);
656  }
657 
665  private boolean batchRemove(Collection<?> c, boolean complement) {
666  final float[] elementData = this.elementData;
667  int r = 0, w = 0;
668  boolean modified = false;
669  try {
670  for (; r < size; r++)
671  if (c.contains(elementData[r]) == complement)
672  elementData[w++] = elementData[r];
673  } finally {
674  // Preserve behavioral compatibility with AbstractCollection,
675  // even if c.contains() throws.
676  if (r != size) {
677  System.arraycopy(
678  elementData, r,
679  elementData, w,
680  size - r);
681  w += size - r;
682  }
683  if (w != size) {
684  for (int i = w; i < size; i++)
685  elementData[i] = 0;
686  modCount += size - w;
687  size = w;
688  modified = true;
689  }
690  }
691  return modified;
692  }
693 
701  private void writeObject(java.io.ObjectOutputStream s)
702  throws java.io.IOException {
703  // Write out element count, and any hidden stuff
704  int expectedModCount = modCount;
705  s.defaultWriteObject();
706 
707  // Write out array length
708  s.writeInt(elementData.length);
709 
710  // Write out all elements in the proper order.
711  for (int i = 0; i < size; i++)
712  s.writeObject(elementData[i]);
713 
714  if (modCount != expectedModCount) {
715  throw new ConcurrentModificationException();
716  }
717 
718  }
719 
726  private void readObject(java.io.ObjectInputStream s)
727  throws java.io.IOException, ClassNotFoundException {
728  // Read in size, and any hidden stuff
729  s.defaultReadObject();
730 
731  // Read in array length and allocate array
732  int arrayLength = s.readInt();
733  float[] a = elementData = new float[arrayLength];
734 
735  // Read in all elements in the proper order.
736  for (int i = 0; i < size; i++)
737  a[i] = (Float) s.readObject();
738  }
739 
751  @Override public ListIterator<Float> listIterator(int index) {
752  if (index < 0 || index > size)
753  throw new IndexOutOfBoundsException("Index: " + index);
754  return new ListItr(index);
755  }
756 
764  @Override public ListIterator<Float> listIterator() {
765  return new ListItr(0);
766  }
767 
774  @Override public Iterator<Float> iterator() {
775  return new Itr();
776  }
777 
779  private class Itr implements Iterator<Float> {
780 
782  int cursor; // index of next element to return
783 
785  int lastRet = -1; // index of last element returned; -1 if no such
786 
788  int expectedModCount = modCount;
789 
790  /* (non-Javadoc)
791  * @see java.util.Iterator#hasNext()
792  */
793  @Override public boolean hasNext() {
794  return cursor != size;
795  }
796 
797  /* (non-Javadoc)
798  * @see java.util.Iterator#next()
799  */
800  @SuppressWarnings("unchecked")
801  @Override public Float next() {
802  checkForComodification();
803  int i = cursor;
804  if (i >= size)
805  throw new NoSuchElementException();
806  float[] elementData = FloatArrayList.this.elementData;
807  if (i >= elementData.length)
808  throw new ConcurrentModificationException();
809  cursor = i + 1;
810  return (Float) elementData[lastRet = i];
811  }
812 
813  /* (non-Javadoc)
814  * @see java.util.Iterator#remove()
815  */
816  @Override public void remove() {
817  if (lastRet < 0)
818  throw new IllegalStateException();
819  checkForComodification();
820 
821  try {
822  FloatArrayList.this.remove(lastRet);
823  cursor = lastRet;
824  lastRet = -1;
825  expectedModCount = modCount;
826  } catch (IndexOutOfBoundsException ex) {
827  throw new ConcurrentModificationException();
828  }
829  }
830 
834  final void checkForComodification() {
835  if (modCount != expectedModCount)
836  throw new ConcurrentModificationException();
837  }
838  }
839 
841  private class ListItr extends Itr implements ListIterator<Float> {
842 
848  ListItr(int index) {
849  super();
850  cursor = index;
851  }
852 
853  /* (non-Javadoc)
854  * @see java.util.ListIterator#hasPrevious()
855  */
856  @Override public boolean hasPrevious() {
857  return cursor != 0;
858  }
859 
860  /* (non-Javadoc)
861  * @see java.util.ListIterator#nextIndex()
862  */
863  @Override public int nextIndex() {
864  return cursor;
865  }
866 
867  /* (non-Javadoc)
868  * @see java.util.ListIterator#previousIndex()
869  */
870  @Override public int previousIndex() {
871  return cursor - 1;
872  }
873 
874  /* (non-Javadoc)
875  * @see java.util.ListIterator#previous()
876  */
877  @SuppressWarnings("unchecked")
878  @Override public Float previous() {
879  checkForComodification();
880  int i = cursor - 1;
881  if (i < 0)
882  throw new NoSuchElementException();
883  float[] elementData = FloatArrayList.this.elementData;
884  if (i >= elementData.length)
885  throw new ConcurrentModificationException();
886  cursor = i;
887  return (Float) elementData[lastRet = i];
888  }
889 
890  /* (non-Javadoc)
891  * @see java.util.ListIterator#set(java.lang.Object)
892  */
893  @Override public void set(Float e) {
894  if (lastRet < 0)
895  throw new IllegalStateException();
896  checkForComodification();
897 
898  try {
899  FloatArrayList.this.set(lastRet, e);
900  } catch (IndexOutOfBoundsException ex) {
901  throw new ConcurrentModificationException();
902  }
903  }
904 
905  /* (non-Javadoc)
906  * @see java.util.ListIterator#add(java.lang.Object)
907  */
908  @Override public void add(Float e) {
909  checkForComodification();
910 
911  try {
912  int i = cursor;
913  FloatArrayList.this.add(i, e);
914  cursor = i + 1;
915  lastRet = -1;
916  expectedModCount = modCount;
917  } catch (IndexOutOfBoundsException ex) {
918  throw new ConcurrentModificationException();
919  }
920  }
921  }
922 
947  @Override public List<Float> subList(int fromIndex, int toIndex) {
948  subListRangeCheck(fromIndex, toIndex, size);
949  return new FloatArrayList.SubList(this, 0, fromIndex, toIndex);
950  }
951 
959  static void subListRangeCheck(int fromIndex, int toIndex, int size) {
960  if (fromIndex < 0)
961  throw new IndexOutOfBoundsException("fromIndex = " + fromIndex);
962  if (toIndex > size)
963  throw new IndexOutOfBoundsException("toIndex = " + toIndex);
964  if (fromIndex > toIndex)
965  throw new IllegalArgumentException(
966  "fromIndex(" + fromIndex +
967  ") > toIndex(" + toIndex + ")");
968  }
969 
973  private class SubList extends FloatArrayList implements RandomAccess {
974 
976  private final FloatArrayList parent;
977 
979  private final int parentOffset;
980 
982  private final int offset;
983 
985  int size;
986 
995  SubList(
997  int offset, int fromIndex, int toIndex) {
998  this.parent = parent;
999  this.parentOffset = fromIndex;
1000  this.offset = offset + fromIndex;
1001  this.size = toIndex - fromIndex;
1002  this.modCount = FloatArrayList.this.modCount;
1003  }
1004 
1005  /* (non-Javadoc)
1006  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#toFloatArray()
1007  */
1008  @Override
1009  public float[] toFloatArray() {
1010  float[] res = new float[size];
1011  System.arraycopy(elementData, offset, res, 0, size);
1012  return res;
1013  }
1014 
1015  /* (non-Javadoc)
1016  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#set(int, java.lang.Float)
1017  */
1018  @Override public Float set(int index, Float e) {
1019  rangeCheck(index);
1021  Float oldValue = FloatArrayList.this.elementData(offset + index);
1022  FloatArrayList.this.elementData[offset + index] = e;
1023  return oldValue;
1024  }
1025 
1026  /* (non-Javadoc)
1027  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#get(int)
1028  */
1029  @Override public Float get(int index) {
1030  rangeCheck(index);
1032  return FloatArrayList.this.elementData(offset + index);
1033  }
1034 
1035  /* (non-Javadoc)
1036  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#size()
1037  */
1038  @Override public int size() {
1040  return this.size;
1041  }
1042 
1043  /* (non-Javadoc)
1044  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#add(int, java.lang.Float)
1045  */
1046  @Override public void add(int index, Float e) {
1047  rangeCheckForAdd(index);
1049  parent.add(parentOffset + index, e);
1050  this.modCount = parent.modCount;
1051  this.size++;
1052  }
1053 
1054  /* (non-Javadoc)
1055  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#remove(int)
1056  */
1057  @Override public Float remove(int index) {
1058  rangeCheck(index);
1060  Float result = parent.remove(parentOffset + index);
1061  this.modCount = parent.modCount;
1062  this.size--;
1063  return result;
1064  }
1065 
1066  /* (non-Javadoc)
1067  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#removeRange(int, int)
1068  */
1069  @Override protected void removeRange(int fromIndex, int toIndex) {
1072  parentOffset + fromIndex,
1073  parentOffset + toIndex);
1074  this.modCount = parent.modCount;
1075  this.size -= toIndex - fromIndex;
1076  }
1077 
1078  /* (non-Javadoc)
1079  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#addAll(java.util.Collection)
1080  */
1081  @Override public boolean addAll(Collection<? extends Float> c) {
1082  return addAll(this.size, c);
1083  }
1084 
1085  /* (non-Javadoc)
1086  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#addAll(int, java.util.Collection)
1087  */
1088  @Override public boolean addAll(int index, Collection<? extends Float> c) {
1089  rangeCheckForAdd(index);
1090  int cSize = c.size();
1091  if (cSize == 0)
1092  return false;
1093 
1095  parent.addAll(parentOffset + index, c);
1096  this.modCount = parent.modCount;
1097  this.size += cSize;
1098  return true;
1099  }
1100 
1101  /* (non-Javadoc)
1102  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#iterator()
1103  */
1104  @Override public Iterator<Float> iterator() {
1105  return listIterator();
1106  }
1107 
1108  /* (non-Javadoc)
1109  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#listIterator(int)
1110  */
1111  @Override public ListIterator<Float> listIterator(final int index) {
1113  rangeCheckForAdd(index);
1114  final int offset = this.offset;
1115 
1116  return new ListIterator<Float>() {
1117  int cursor = index;
1118  int lastRet = -1;
1119  int expectedModCount = FloatArrayList.this.modCount;
1120 
1121  @Override public boolean hasNext() {
1122  return cursor != FloatArrayList.SubList.this.size;
1123  }
1124 
1125  @SuppressWarnings("unchecked")
1126  @Override public Float next() {
1128  int i = cursor;
1129  if (i >= FloatArrayList.SubList.this.size)
1130  throw new NoSuchElementException();
1131  float[] elementData = FloatArrayList.this.elementData;
1132  if (offset + i >= elementData.length)
1133  throw new ConcurrentModificationException();
1134  cursor = i + 1;
1135  return (Float) elementData[offset + (lastRet = i)];
1136  }
1137 
1138  @Override public boolean hasPrevious() {
1139  return cursor != 0;
1140  }
1141 
1142  @SuppressWarnings("unchecked")
1143  @Override public Float previous() {
1145  int i = cursor - 1;
1146  if (i < 0)
1147  throw new NoSuchElementException();
1148  float[] elementData = FloatArrayList.this.elementData;
1149  if (offset + i >= elementData.length)
1150  throw new ConcurrentModificationException();
1151  cursor = i;
1152  return (Float) elementData[offset + (lastRet = i)];
1153  }
1154 
1155  @Override public int nextIndex() {
1156  return cursor;
1157  }
1158 
1159  @Override public int previousIndex() {
1160  return cursor - 1;
1161  }
1162 
1163  @Override public void remove() {
1164  if (lastRet < 0)
1165  throw new IllegalStateException();
1167 
1168  try {
1169  FloatArrayList.SubList.this.remove(lastRet);
1170  cursor = lastRet;
1171  lastRet = -1;
1172  expectedModCount = FloatArrayList.this.modCount;
1173  } catch (IndexOutOfBoundsException ex) {
1174  throw new ConcurrentModificationException();
1175  }
1176  }
1177 
1178  @Override public void set(Float e) {
1179  if (lastRet < 0)
1180  throw new IllegalStateException();
1182 
1183  try {
1184  FloatArrayList.this.set(offset + lastRet, e);
1185  } catch (IndexOutOfBoundsException ex) {
1186  throw new ConcurrentModificationException();
1187  }
1188  }
1189 
1190  @Override public void add(Float e) {
1192 
1193  try {
1194  int i = cursor;
1195  FloatArrayList.SubList.this.add(i, e);
1196  cursor = i + 1;
1197  lastRet = -1;
1198  expectedModCount = FloatArrayList.this.modCount;
1199  } catch (IndexOutOfBoundsException ex) {
1200  throw new ConcurrentModificationException();
1201  }
1202  }
1203 
1204  final void checkForComodification() {
1205  if (expectedModCount != FloatArrayList.this.modCount)
1206  throw new ConcurrentModificationException();
1207  }
1208  };
1209  }
1210 
1211  /* (non-Javadoc)
1212  * @see eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj.FloatArrayList#subList(int, int)
1213  */
1214  @Override public List<Float> subList(int fromIndex, int toIndex) {
1215  subListRangeCheck(fromIndex, toIndex, size);
1216  return new FloatArrayList.SubList(this, offset, fromIndex, toIndex);
1217  }
1218 
1224  private void rangeCheck(int index) {
1225  if (index < 0 || index >= this.size)
1226  throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
1227  }
1228 
1234  private void rangeCheckForAdd(int index) {
1235  if (index < 0 || index > this.size)
1236  throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
1237  }
1238 
1245  private String outOfBoundsMsg(int index) {
1246  return "Index: " + index + ", Size: " + this.size;
1247  }
1248 
1252  private void checkForComodification() {
1253  if (FloatArrayList.this.modCount != this.modCount)
1254  throw new ConcurrentModificationException();
1255  }
1256  }
1257 }
boolean addAll(int index, Collection<? extends Float > c)
boolean batchRemove(Collection<?> c, boolean complement)
List< Float > subList(int fromIndex, int toIndex)
boolean addAll(int index, Collection<? extends Float > c)