items[second] = firstValue;\r
}\r
\r
- /** @param identity If true, == comparison will be used. If false, .equals() comaparison will be used. */\r
+ /**\r
+ * Returns if this array contains value.\r
+ * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+ * @return true if array contains value, false if it doesn't\r
+ */\r
public boolean contains (T value, boolean identity) {\r
T[] items = this.items;\r
int i = size - 1;\r
return false;\r
}\r
\r
+ /**\r
+ * Returns an index of first occurrence of value in array or -1 if no such value exists\r
+ * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+ * @return An index of first occurrence of value in array or -1 if no such value exists\r
+ */\r
public int indexOf (T value, boolean identity) {\r
T[] items = this.items;\r
if (identity || value == null) {\r
return -1;\r
}\r
\r
+ /**\r
+ * Returns an index of last occurrence of value in array or -1 if no such value exists.\r
+ * Search is started from the end of an array.\r
+ * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+ * @return An index of first occurrence of value in array or -1 if no such value exists\r
+ */\r
public int lastIndexOf (T value, boolean identity) {\r
T[] items = this.items;\r
if (identity || value == null) {\r
return -1;\r
}\r
\r
+ /**\r
+ * Removes value from an array if it exists.\r
+ * @param identity If true, == comparison will be used. If false, .equals() comparison will be used.\r
+ * @return true if value was found and removed, false otherwise\r
+ */\r
public boolean removeValue (T value, boolean identity) {\r
T[] items = this.items;\r
if (identity || value == null) {\r