1 5 package org.exoplatform.commons.utils; 6 7 import java.util.ArrayList ; 8 13 public class ListenerStack extends ArrayList { 14 public ListenerStack() { 15 super() ; 16 } 17 18 public ListenerStack(int size) { 19 super(size) ; 20 } 21 22 public void add(int index, Object element) { 23 throw new UnsupportedOperationException ("use add(java.lang.Object)") ; 24 } 25 26 public boolean add(java.lang.Object obj) { 27 String name = obj.getClass().getName(); 28 for(int i = 0; i < size(); i++) { 29 Object found = get(i) ; 30 if(name.equals(found.getClass().getName())) { 31 remove(i) ; 32 break ; 33 } 34 } 35 return super.add(obj) ; 36 } 37 } 38 | Popular Tags |