/** Removes revoked and invalid photo attributes from a photo attribute array. */ private PhotoAttribute[] filterArray(PhotoAttribute[] original) { List<PhotoAttribute> filtered = new ArrayList<>(); for (PhotoAttribute att : original) { if (!att.isRevokedOrInvalid()) { filtered.add(att); } } return filtered.toArray(new PhotoAttribute[filtered.size()]); }