public List getDistinctDBIn() { if (distinctIn == null) { synchronized(this) { if (getIn() == null) return null; List distinctIn = new ArrayList(getIn().size()); for (DBInput input : getDBIn()) { if (input == null) continue; if (input.getDBPrevOut() == null) { distinctIn.add(input); continue; } boolean found = false; for (DBInput existing : distinctIn) { if (existing == null || existing.getDBPrevOut() == null) continue; if (existing.getDBPrevOut().getAddress() != null && existing.getDBPrevOut().getAddress().equals(input.getDBPrevOut().getAddress())) { found = true; existing.value += input.getPrevOut().value; break; } } if (!found) { distinctIn.add(input); } } this.distinctIn = distinctIn; } } return distinctIn; }