Here you can find the source of add(Collection
public static <T> void add(Collection<T> collection, T object)
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static <T> void add(Collection<T> collection, T object) { collection.remove(object);/*from w ww. j a v a2s . co m*/ collection.add(object); } }