File (@NotNull File jarFile, @NotNull Collection<? extends Pair<String, byte[]>> namesAndContents) { try (ZipOutputStream stream = new ZipOutputStream(new FileOutputStream(jarFile))) { for (Pair<String, byte[]> p : namesAndContents) { String name = p.first; byte[] content = p.second; stream.putNextEntry(new ZipEntry(name)); stream.write(content); stream.closeEntry(); } return jarFile; } catch (IOException e) { throw new RuntimeException(e); } }