private static int toIndexType(Duplicate duplicate) { if (duplicate instanceof InnerDuplicate) { return 0; } if (duplicate instanceof InProjectDuplicate) { return 1; } if (duplicate instanceof CrossProjectDuplicate) { return 2; } throw new IllegalArgumentException( "Unsupported type of Duplicate " + duplicate.getClass().getName()); }
@Override @Nonnull public String apply(@Nonnull Duplicate duplicate) { if (duplicate instanceof InnerDuplicate) { return ""; } if (duplicate instanceof InProjectDuplicate) { return ((InProjectDuplicate) duplicate).getFile().getKey(); } if (duplicate instanceof CrossProjectDuplicate) { return ((CrossProjectDuplicate) duplicate).getFileKey(); } throw new IllegalArgumentException( "Unsupported type of Duplicate " + duplicate.getClass().getName()); }