This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Format a JSON string and make it more readable | |
* Created by kshang on 20/04/2017. | |
*/ | |
public class JsonFormatter { | |
public String format(String input) { | |
StringBuilder sb = new StringBuilder(); | |
char[] chars = input.toCharArray(); | |
boolean inQuote = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# docdist8.py - treat whole file as a single "line" | |
# | |
# Original version by Erik D. Demaine on January 31, 2011, | |
# based on code by Ronald L. Rivest (see docdist[1-7].py). | |
# | |
# Usage: | |
# docdist8.py filename1 filename2 | |
# | |
# This program computes the "distance" between two text files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListFactory { | |
public ListFactory() { | |
super(); | |
} | |
public static List newInstance(final int[] numbers) { | |
return new ListFactory$1(numbers); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListFactory { | |
public static List<Integer> newInstance(final int[] numbers) { | |
return new AbstractList<Integer>() { | |
@Override | |
public Integer get(int index) { | |
return numbers[index]; | |
} |