Java examples for java.util:Vector Element
Adds an object to the start of a Vector if not already contained.
//package com.java2s; import java.util.Vector; public class Main { /** Adds an object to the start of a list if not already contained. */ public static void tryInsert(Vector vector, Object object) { if (object == null) { return; }/*from w ww . j a va 2 s . c om*/ if (!vector.contains(object)) { vector.insertElementAt(object, 0); } } }