- 论坛徽章:
- 0
|
- import java.util.*;
- public class TestArrayList
- {
- public static void main(String args[])
- {
-
- Object[][] o={{"sd","fh","gd"},{"sf","gd","hds"},{"yr","fh","hgs"},{"sg","fh","hfsd"},{"ut","sg","sgh"},{"jg","jkg","jf"}};
- int row=0;
- ArrayList al=new ArrayList();
- int[] intKey={1,2};
- Object[] keyValue={"fh",""};
- for(int i=0;i<o.length;i++)
- {
- for(int j=0;j<o[0].length;j++)
- {
- al.add(o[i][j]);
- }
- }
- System.out.println(al.size());
- for(int i=0;i<o.length;i++)
- {
- for(int j=0;j<intKey.length;j++)
- {
- if(!o[i][intKey[j]].equals(keyValue[j]))
- {
- for(int k=0;k<o[0].length;k++)
- {
-
- al.remove(i*o[0].length-row*o[0].length);
-
- }
- row++;
- }
- }
-
- }
- System.out.println(al);
- }
- }
复制代码
在这段代码中
我怎么才能在第二个循环中当在每一行中发现一个不相等的条件就从第二个循环中跳出来呢?然后执行第二行的判断?
帮忙看看了! |
|