publicArrayList<MemberInfo>removeMembers(int year){ArrayList<MemberInfo> goodStanding =newArrayList<MemberInfo>(); int i =0;while(i <memberList.size()) {if(memberList.get(i).getGradYear() <= year) {MemberInfo removed =memberList.remove(i);if(removed.inGoodStanding())goodStanding.add(removed); }else i++; }return goodStanding;}
ArrayResizer
publicstaticbooleanisNonZeroRow(int[][] array2D,int r){for(int c =0; c < array2D[0].length; c++) {if(array2D[r][c] ==0)returnfalse; }returntrue;}
publicstaticint[][] resize(int[][] array2D){int[][] newArray =newint[numNonZeroRows(array2D)][array2D[0].length];int newR =0;for(int oldR =0; oldR <array2D.length; oldR++) {if(isNonZeroRow(array2D, oldR)) {// could copy elements within row instead newArray[newR] = array2D[oldR]; newR++; } } return newArray;}
ArrayTester
publicstaticint[] getColumn(int[][] arr2D,int c){int[] column =newint[arr2D.length];for(int i =0; i <column.length; i++) column[i] = arr2D[i][c];return column;}
publicstaticbooleanisLatin(int[][] square){if(containsDuplicates(square[0]))returnfalse;for(int r =1; r <square.length; r++)if(!hasAllValues(square[0], square[r]) )returnfalse;for(int c =0; c < square[0].length; c++)if(!hasAllValues(square[0], getColumn(square, c)))returnfalse;returntrue;}