Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / src / javajs / util / Lst.java
1 /* $RCSfile$
2  * $Author: hansonr $
3  * $Date: 2007-04-26 16:57:51 -0500 (Thu, 26 Apr 2007) $
4  * $Revision: 7502 $
5  *
6  * Copyright (C) 2005  The Jmol Development Team
7  *
8  * Contact: jmol-developers@lists.sf.net
9  *
10  *  This library is free software; you can redistribute it and/or
11  *  modify it under the terms of the GNU Lesser General Public
12  *  License as published by the Free Software Foundation; either
13  *  version 2.1 of the License, or (at your option) any later version.
14  *
15  *  This library is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  *  Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; if not, write to the Free Software
22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24
25 package javajs.util;
26
27 import java.util.ArrayList;
28
29 /**
30  * created to remove ambiguities in add and remove
31  * 
32  * @param <V>
33  */
34 public class Lst<V> extends ArrayList<V> {
35
36   public Lst() {
37     super();  
38   }
39   
40   /**
41    * @j2sIgnore
42    * 
43    */
44   @Override
45   @Deprecated
46   public boolean add(V v) {
47     throw new NullPointerException("use addLast(value), not add(value) in List for JavaScript compatibility");
48   }
49   
50   public boolean addLast(V v) {
51     /**
52      * no overloading of add(Object) in JavaScript
53      * 
54      * @j2sNative
55      * 
56      * return this.add1(v);
57      *  
58      */
59     {
60       return super.add(v);
61     }
62   }
63   
64   /**
65    * @j2sIgnore
66    * 
67    */
68   @Override
69   @Deprecated
70   public boolean remove(Object v) {
71     throw new NullPointerException("use removeObj(obj), not remove(obj) in List for JavaScript compatibility");
72   }
73   
74   public boolean removeObj(Object v) {
75     /**
76      * no overloading of remove(Object) in JavaScript
77      * 
78      * @j2sNative
79      * 
80      * return this.removeObject(v);
81      *  
82      */
83     {
84       return super.remove(v);
85     }
86   }
87   
88 }