public static void main(String arg[]) { Scanner scan = new Scanner(System.in); System.out.println("enter the size of array"); int arraySize = scan.nextInt(); int input[] = new int[arraySize]; System.out.println("enter elements in array"); for (int i = 0; i < arraySize; i++) { input[i] = scan.nextInt(); } Duplicate a = new Duplicate(); for (int i = 0; i < a.removeDuplicate(input).length; i++) { System.out.print(a.removeDuplicate(input)[i]); } scan.close(); }
@Override public boolean apply(@Nullable Duplicate input) { if (input instanceof InnerDuplicate) { checkArgument( !original.equals(input.getTextBlock()), "TextBlock of an InnerDuplicate can not be the original TextBlock"); } return true; }
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()); }
@Override @Nonnull public TextBlock apply(@Nonnull Duplicate input) { return input.getTextBlock(); }