- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Connection c =
DataSource dataSource;dataSource.getConnection()
String url;DriverManager.getConnection(url)
IdentityDatabaseUtil.getDBConnection()
- Smart code suggestions by Codota
}
protected void unsafeSwap(int i, int j) { if (i == j) return; unsafeFastSwap(i, j); }
/** * Removes the element at the specified position in this list. * This method is faster than {@link RecyclingArrayList#remove(int)} but the ith element is swapped with the last element changing the ordering of the list. * * @param index the index of the element to be removed */ public void fastRemove(int index) { if (index == size - 1) { size--; return; } rangeCheck(index); unsafeFastSwap(index, --size); }
/** * Inserts a new element at the specified position in this * list. Shifts the element currently at that position (if any) and * any subsequent elements to the right (adds one to their indices). * * @param index index at which the new element is to be inserted * @return the new inserted element * @throws IndexOutOfBoundsException if the index is out of range * (<tt>index < 0 || index >= size()</tt>) */ public T insertAtIndex(int index) { rangeCheckForInsert(index); // First add new element at last index T ret = add(); // Then go trough the list by swapping elements two by two to reach the desired index for (int i = size - 1; i > index; i--) unsafeFastSwap(i, i - 1); return ret; }