Java examples for java.util:Vector Element
Adds an object to a Vector if not already contained.
//package com.java2s; import java.util.Vector; public class Main { /** Adds an object to a list if not already contained. */ public static void tryAdd(Vector vector, Object object) { if (object == null) { return; }//from ww w. ja v a 2s .co m if (!vector.contains(object)) { vector.add(object); } } }