Skip to content

Instantly share code, notes, and snippets.

@nickiannone
Forked from KodeSeeker/gist:5136430
Last active December 14, 2015 19:28
Show Gist options
  • Save nickiannone/5136482 to your computer and use it in GitHub Desktop.
Save nickiannone/5136482 to your computer and use it in GitHub Desktop.
// Taken from http://stackoverflow.com/a/4777636/410342, and made immutable
public class Pair<L,R> {
private L l;
private R r;
public Pair(L l, R r){
this.l = l;
this.r = r;
}
public L getL(){ return l; }
public R getR(){ return r; }
}
ArrayList<Pair<Integer,Integer>> zeroList=new ArrayList<Pair<Integer,Integer>>();
for(int i=0;i<rows;i++){
for (int j=0;j<col;j++){
if(a[i][j]==0){
zeroList.add(new Pair<Integer, Integer>(i,j));
}
}
return zeroList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment