Given an arraylist and two start and end indexes, how can you check if a certain sub-ArrayList is present in the “window” i.e. between the indexes.
i.e.
private ArrayList<Character> list = new ArrayList<Character>;
private int start = 2, end = 6;
private ArrayList<Character> sublist = new ArrayList<Character>;
boolean present = isPresent();
How can I implement this isPresent() method efficiently? I will be using this method inside
a run-time encoding algorithm, to compress a text file (it’s required I read it into an ArrayList first).
1 Answer