/** * Checks whether a given list of duplicates can be replaced by a single one. * @param filename the filename of the files * @param list the list of dup files * @throws DifferentLibException * @throws Sha1Exception */ private void checkEntities(String filename, List<JarEntity> list) throws DifferentLibException, Sha1Exception { if (list.size() == 1) { return; } JarEntity baseEntity = list.get(0); long baseLength = baseEntity.getLength(); String baseSha1 = baseEntity.getSha1(); final int count = list.size(); for (int i = 1; i < count ; i++) { JarEntity entity = list.get(i); if (entity.getLength() != baseLength || entity.getSha1().equals(baseSha1) == false) { throw new DifferentLibException("Jar mismatch! Fix your dependencies", getEntityDetails(filename, list)); } } }