Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<DBInput> getDistinctDBIn() {
- if (distinctIn == null) {
- synchronized(this) {
- if (getIn() == null)
- return null;
- List<DBInput> distinctIn = new ArrayList<DBInput>(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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement