From 09bd2e2eb9c2aa8733e82f258419648fdebcfb30 Mon Sep 17 00:00:00 2001 From: E1 471 Date: Sun, 17 May 2015 11:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\347\273\204\345\210\227\350\241\250.java" | 61 +++++++++---------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git "a/src/legacy/\347\210\252\345\223\207/\345\205\254\347\224\250/\346\225\260\347\273\204\345\210\227\350\241\250.java" "b/src/legacy/\347\210\252\345\223\207/\345\205\254\347\224\250/\346\225\260\347\273\204\345\210\227\350\241\250.java" index f41aece..3e50058 100644 --- "a/src/legacy/\347\210\252\345\223\207/\345\205\254\347\224\250/\346\225\260\347\273\204\345\210\227\350\241\250.java" +++ "b/src/legacy/\347\210\252\345\223\207/\345\205\254\347\224\250/\346\225\260\347\273\204\345\210\227\350\241\250.java" @@ -2,38 +2,37 @@ package legacy.爪哇.公用; import java.util.ArrayList; import java.util.Collection; +import java.util.Random; -public class 数组列表<元素类> { - private ArrayList<元素类> 对象; +public class 数组列表<元素类> extends ArrayList<元素类> { - public 数组列表() { - 对象 = new ArrayList<元素类>(); - } + + public 数组列表(){ + super(); + } + + /** + * 将指定的元素添加到此列表的尾部。 + * + * @param i 要添加到此列表中的元素 + * @return true (按照 {@link Collection#add} 的指定) + */ + public boolean 添加(元素类 i) { + return this.add(i); + } + + public void 添加(int 索引, 元素类 元素) { + this.add(索引, 元素); + } - // TODO: javadoc - public 元素类 取(int 索引) { - return 对象.get(索引); - } - - /** - * 将指定的元素添加到此列表的尾部。 - * - * @param 元素 要添加到此列表中的元素 - * @return true (按照 {@link Collection#add} 的指定) - */ - public boolean 添加(元素类 元素) { - return 对象.add(元素); - } - - public void 添加(int 索引, 元素类 元素) { - 对象.add(索引, 元素); - } - - public int 长度() { - return 对象.size(); - } - - public ArrayList<元素类> 原型() { - return 对象; - } + public int 长度() { + return this.size(); + } + + public int 随机() + { + Random rnd = new Random(); + return(rnd.nextInt(100)); + } + } -- Gitee