Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public void removeCol(int col) {
  2. for (int i = entries.size() - 1; i >= 0; i--) {
  3. SparseArrayEntry entry = entries.get(i);
  4. if (entry.getCol() > col) {
  5. // Fix the column number for this item because it's in a column
  6. // to the right of the column we're removing
  7. SparseArrayEntry fixedEntry = new SparseArrayEntry(entry.getRow(),
  8. entry.getCol() - 1,
  9. entry.getValue());
  10. entries.set(i, fixedEntry);
  11. }
  12. else if (entry.getCol() == col) {
  13. // Remove this item because it's inside the column we're removing
  14. entries.remove(i);
  15. }
  16. }
  17.  
  18. // Update the numCols variable since we removed one column.
  19. numCols--;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement