public void update(Long pos, Object readpos, HashMap<Long, ArrayList<String>> map) { // USE BUECKTS ReadPos rp = (ReadPos) readpos; Long Buck = new Long(((Long) pos).longValue() / BUCKET_SIZE); ArrayList<String> reads = map.get(Buck); if (reads == null) { reads = new ArrayList<String>(); } // also add read START and END to the list String spos = rp.toString(); if (!reads.contains(spos)) { reads.add(spos); // p("Adding rp "+spos+" to bucket "+Buck); } map.put(Buck, reads); }