void (final String value) { myList.remove(value); if (myList.size() >= ourMaxTypedUrls) { // leave space for 1 to be added final int numToRemove = myList.size() - ourMaxTypedUrls + 1; myList.subList(0, numToRemove).clear(); } // more recent first myList.add(0, value); }