602723113
如题,比如现在有个武器上的Lore有 3行 第一行是:测试1,第二行是:测试2,第三行是:测试3
请问怎么才能判断 "测试2" 所在的行数呢?

a8105
List有indexOf方法...:
String target="测试2";
int index=lore.indexOf(target);
boolean exists=index!=-1;

        public int getIndex(List<String> lore, String s) {
                int i = 0;
                for (String a : lore) {
                        if (a.equalsIgnoreCase(s)) {
                                return i;
                        }
                        i++;
                }
                return -1;
        }