@Test public void testOneCyclicPair() { String[] input = {"abc","acb", "cab"}; CyclicWordsKata tester = new CyclicWordsKata(input); List<List<String>> results = tester.process(); assertEquals("Result", 2, results.size()); }
public List<List<String>> process() { List<List<String>> processed = new ArrayList<List<String>>(); Map<Integer,List<String>> buckets ; List<List<String>> returnArray ; buckets = separateInputBySize(_input); if(buckets == null) return processed; for(int size: buckets.keySet()) { List<String> elements = buckets.get(size); System.out.println("size " + size); while(elements != null && elements.size() > 0) { returnArray = processSameSizeArray(elements); elements = returnArray.get(1) ; processed.add(returnArray.get(0)); } } return processed; }
CyclicWordsKata { public List<List<String>> process() { List<List<String>> processed = new ArrayList<List<String>>(); Map<Integer,List<String>> buckets ; List<List<String>> returnArray ; buckets = separateInputBySize(_input); if(buckets == null) return processed; for(int size: buckets.keySet()) { List<String> elements = buckets.get(size); System.out.println("size " + size); while(elements != null && elements.size() > 0) { returnArray = processSameSizeArray(elements); elements = returnArray.get(1) ; processed.add(returnArray.get(0)); } } return processed; } }
CyclicWordsKata { public List<List<String>> process() { List<List<String>> processed = new ArrayList<List<String>>(); Map<Integer,List<String>> buckets ; List<List<String>> returnArray ; buckets = separateInputBySize(_input); if(buckets == null) return processed; for(int size: buckets.keySet()) { List<String> elements = buckets.get(size); System.out.println("size " + size); while(elements != null && elements.size() > 0) { returnArray = processSameSizeArray(elements); elements = returnArray.get(1) ; processed.add(returnArray.get(0)); } } return processed; } CyclicWordsKata(String[] input); }
CyclicWordsKata { public List<List<String>> process() { List<List<String>> processed = new ArrayList<List<String>>(); Map<Integer,List<String>> buckets ; List<List<String>> returnArray ; buckets = separateInputBySize(_input); if(buckets == null) return processed; for(int size: buckets.keySet()) { List<String> elements = buckets.get(size); System.out.println("size " + size); while(elements != null && elements.size() > 0) { returnArray = processSameSizeArray(elements); elements = returnArray.get(1) ; processed.add(returnArray.get(0)); } } return processed; } CyclicWordsKata(String[] input); List<List<String>> process(); Map<Integer,List<String>> separateInputBySize(String[] input); String joinStringArray(List<String> arrayList, String connector); static void main(String[] args); }
CyclicWordsKata { public List<List<String>> process() { List<List<String>> processed = new ArrayList<List<String>>(); Map<Integer,List<String>> buckets ; List<List<String>> returnArray ; buckets = separateInputBySize(_input); if(buckets == null) return processed; for(int size: buckets.keySet()) { List<String> elements = buckets.get(size); System.out.println("size " + size); while(elements != null && elements.size() > 0) { returnArray = processSameSizeArray(elements); elements = returnArray.get(1) ; processed.add(returnArray.get(0)); } } return processed; } CyclicWordsKata(String[] input); List<List<String>> process(); Map<Integer,List<String>> separateInputBySize(String[] input); String joinStringArray(List<String> arrayList, String connector); static void main(String[] args);  }