@Override public SerializableMetadata get(byte[] md5) { Objects.requireNonNull(md5, "MD5 checksum"); if (!inited) { refresh(); } for (SerializableMetadata m : metadata) { if (Arrays.equals(m.getMd5Sum(), md5)) { return m; } } return null; }
@Override public SerializableMetadata get(String name, String version) { Objects.requireNonNull(name, "Name in meta data"); if (!inited) { refresh(); } if (version != null) { for (SerializableMetadata m : metadata) { if (name.equals(m.getName()) && version.equals(m.getVersion())) { return m; } } } else { Comparator<Metadata> cmp = Collections.reverseOrder(MetadataUtils.makeVersionComparator()); Object[] arr = metadata.stream().filter(m -> m.getName().equals(name)).sorted(cmp).toArray(); if (arr.length > 0) { return (SerializableMetadata) arr[0]; } } return null; }