Skip to content

Instantly share code, notes, and snippets.

export class Y {
}
public abstract class OverridableFromConstructor {
OverridableFromConstructor() {
test();
}
protected abstract void test();
static class SubClass extends OverridableFromConstructor {
private int i = 10;
import java.lang.reflect.Field;
import java.util.HashMap;
public class MapTest {
private static class X {
private int value;
public X(int value) {
this.value = value;
public class SwingTest {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
Block b = new Block("block1");
Block bb = new Block("block2");
JFrame jf = new JFrame();
fun main(args: Array<String>) {
val map = HashMap<String, String>()
map.iterator().remove();
}
package com.threads;
/**
* demonstrate race conditions
*/
public class Step4 {
private int a;
public int getA() {
public class ThreadTest {
private volatile boolean stop = false;
public void test() throws Exception {
new Thread(() -> {
while (!stop) {
}
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class Encryption {
JButton addItemButton = new JButton("Add Item with icon");
addItemButton.addActionListener(e -> {
map.put("foo", load("https://i.imgur.com/tSiZYyw.png"));
testBox.addItem("foo");
});
add(addItemButton);
data class Student(val id: String, var name: String? = null)
fun main(args: Array<String>) {
val list = mutableListOf(Student("a", "John"), Student("b", "Jane"))
list.filter { l -> l.id == "b" }
.map { l -> l.name = "Jack" }
.toList()
println("list = ${list}")
}