Lines Matching refs:index

50      * Returns the element of the array at the specified index. This reproduces
51 * the effect of {@code array[index]}. If the array component is a primitive
56 * @param index
57 * the index
66 * if {@code index < 0 || index >= array.length}
70 public static Object get(Object array, int index)
73 return ((Object[]) array)[index];
76 return ((boolean[]) array)[index] ? Boolean.TRUE : Boolean.FALSE;
79 return new Byte(((byte[]) array)[index]);
82 return new Character(((char[]) array)[index]);
85 return new Short(((short[]) array)[index]);
88 return new Integer(((int[]) array)[index]);
91 return new Long(((long[]) array)[index]);
94 return new Float(((float[]) array)[index]);
97 return new Double(((double[]) array)[index]);
106 * Returns the element of the array at the specified index, converted to a
108 * array[index]}
112 * @param index
113 * the index
121 * index position can not be converted to the return type
123 * if {@code index < 0 || index >= array.length}
127 public static boolean getBoolean(Object array, int index)
130 return ((boolean[]) array)[index];
141 * Returns the element of the array at the specified index, converted to a
143 * array[index]}
147 * @param index
148 * the index
156 * index position can not be converted to the return type
158 * if {@code index < 0 || index >= array.length}
162 public static byte getByte(Object array, int index)
165 return ((byte[]) array)[index];
167 return getBoolean(array, index) ? (byte)1 : (byte)0;
172 * Returns the element of the array at the specified index, converted to a
174 * array[index]}
178 * @param index
179 * the index
187 * index position can not be converted to the return type
189 * if {@code index < 0 || index >= array.length}
193 public static char getChar(Object array, int index)
196 return ((char[]) array)[index];
207 * Returns the element of the array at the specified index, converted to a
209 * array[index]}
213 * @param index
214 * the index
222 * index position can not be converted to the return type
224 * if {@code index < 0 || index >= array.length}
228 public static double getDouble(Object array, int index)
231 return ((double[]) array)[index];
233 return getFloat(array, index);
238 * Returns the element of the array at the specified index, converted to a
240 * array[index]}
244 * @param index
245 * the index
253 * index position can not be converted to the return type
255 * if {@code index < 0 || index >= array.length}
259 public static float getFloat(Object array, int index)
262 return ((float[]) array)[index];
264 return getLong(array, index);
269 * Returns the element of the array at the specified index, converted to an
271 * array[index]}
275 * @param index
276 * the index
284 * index position can not be converted to the return type
286 * if {@code index < 0 || index >= array.length}
290 public static int getInt(Object array, int index)
293 return ((int[]) array)[index];
295 return getShort(array, index);
350 * Returns the element of the array at the specified index, converted to a
352 * array[index]}
356 * @param index
357 * the index
365 * index position can not be converted to the return type
367 * if {@code index < 0 || index >= array.length}
371 public static long getLong(Object array, int index)
374 return ((long[]) array)[index];
376 return getInt(array, index);
381 * Returns the element of the array at the specified index, converted to a
383 * array[index]}
387 * @param index
388 * the index
396 * index position can not be converted to the return type
398 * if {@code index < 0 || index >= array.length}
402 public static short getShort(Object array, int index)
405 return ((short[]) array)[index];
407 return getByte(array, index);
513 * Sets the element of the array at the specified index to the value. This
514 * reproduces the effect of {@code array[index] = value}. If the array
519 * @param index
520 * the index
530 * if {@code index < 0 || index >= array.length}
534 public static void set(Object array, int index, Object value)
547 ((Object[]) array)[index] = value;
554 setBoolean(array, index, ((Boolean) value).booleanValue());
556 setByte(array, index, ((Byte) value).byteValue());
558 setChar(array, index, ((Character) value).charValue());
560 setShort(array, index, ((Short) value).shortValue());
562 setInt(array, index, ((Integer) value).intValue());
564 setLong(array, index, ((Long) value).longValue());
566 setFloat(array, index, ((Float) value).floatValue());
568 setDouble(array, index, ((Double) value).doubleValue());
573 * Sets the element of the array at the specified index to the {@code
574 * boolean} value. This reproduces the effect of {@code array[index] =
579 * @param index
580 * the index
590 * if {@code index < 0 || index >= array.length}
594 public static void setBoolean(Object array, int index, boolean value) {
596 ((boolean[]) array)[index] = value;
598 setByte(array, index, value ? (byte)1 : (byte)0);
603 * Sets the element of the array at the specified index to the {@code byte}
604 * value. This reproduces the effect of {@code array[index] = value}.
608 * @param index
609 * the index
619 * if {@code index < 0 || index >= array.length}
623 public static void setByte(Object array, int index, byte value)
626 ((byte[]) array)[index] = value;
628 setShort(array, index, value);
633 * Set the element of the array at the specified index to the {@code char}
634 * value. This reproduces the effect of {@code array[index] = value}.
638 * @param index
639 * the index
649 * if {@code index < 0 || index >= array.length}
653 public static void setChar(Object array, int index, char value)
656 ((char[]) array)[index] = value;
667 * Set the element of the array at the specified index to the {@code double}
668 * value. This reproduces the effect of {@code array[index] = value}.
672 * @param index
673 * the index
683 * if {@code index < 0 || index >= array.length}
687 public static void setDouble(Object array, int index, double value)
690 ((double[]) array)[index] = value;
701 * Set the element of the array at the specified index to the {@code float}
702 * value. This reproduces the effect of {@code array[index] = value}.
706 * @param index
707 * the index
717 * if {@code index < 0 || index >= array.length}
721 public static void setFloat(Object array, int index, float value)
724 ((float[]) array)[index] = value;
726 setDouble(array, index, value);
731 * Set the element of the array at the specified index to the {@code int}
732 * value. This reproduces the effect of {@code array[index] = value}.
736 * @param index
737 * the index
747 * if {@code index < 0 || index >= array.length}
751 public static void setInt(Object array, int index, int value)
754 ((int[]) array)[index] = value;
756 setLong(array, index, value);
761 * Set the element of the array at the specified index to the {@code long}
762 * value. This reproduces the effect of {@code array[index] = value}.
766 * @param index
767 * the index
777 * if {@code index < 0 || index >= array.length}
781 public static void setLong(Object array, int index, long value)
784 ((long[]) array)[index] = value;
786 setFloat(array, index, value);
791 * Set the element of the array at the specified index to the {@code short}
792 * value. This reproduces the effect of {@code array[index] = value}.
796 * @param index
797 * the index
807 * if {@code index < 0 || index >= array.length}
811 public static void setShort(Object array, int index, short value)
814 ((short[]) array)[index] = value;
816 setInt(array, index, value);