📄 oneliners.java
字号:
import java.util.*;
public class OneLiners {
public static void main(String[] args) {
// Part A
String[] breakfast = { "spam", "sausage", "spam", "spam", "bacon",
"spam", "tomato", "spam" };
System.out.println(withoutDuplicates(Arrays.asList(breakfast)));
// Part B
String weaponry = "fear, surprise,ruthless efficiency, an almost " +
"fanatical devotion to the Pope, nice red uniforms";
System.out.println(Arrays.asList(parse(weaponry)));
// Part C
int[][] magic = {{6, 7, 2}, {1, 5, 9}, {8, 3, 4}};
System.out.println(arrayToString(magic));
// Part D
System.out.println(hasMoreBitsSet(0x0f0f0f0f, 0x88888888)); // true
System.out.println(hasMoreBitsSet(0x88888888, 0x0f0f0f0f)); // false
}
// Part A
static <E> List<E> withoutDuplicates(List<E> original) {
// Your code goes here
}
// Part B
static String[] parse(String string) {
// Your code goes here
}
// Part C
static String arrayToString(Object[] array) {
// Your code goes here
}
// Part D
static boolean hasMoreBitsSet(int i, int j) {
// Your code goes here
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -