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
package com.example; | |
interface Hello { | |
void hello(); | |
} | |
class A implements Hello { | |
static { | |
System.out.println("Static init A"); | |
} |
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
package com.example; | |
import java.util.Date; | |
public class Main { | |
public static void main(String[] args) { | |
final Date source = new Date(); | |
final Date prev = new Date(source.getTime() - 1000); | |
final Date same = new Date(source.getTime()); | |
final Date next = new Date(source.getTime() + 1000); |
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
package com.example; | |
import java.io.Serializable; | |
import java.util.List; | |
interface HasId<Id extends Serializable, Entity extends HasId<Id, Entity>> { | |
Id getId(); | |
Entity setId(final Id id); | |
} |
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
package com.example; | |
import java.io.Serializable; | |
import java.util.List; | |
interface HasId<Id extends Serializable, Entity extends HasId<Id, Entity>> { | |
Id getId(); | |
Entity setId(final Id id); | |
} |
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
/** | |
* Sort enum example problem for JetBrains support (try to "Sort content" inside the enum). | |
*/ | |
public class Main { | |
public static void main(String[] args) { | |
for (final Mode mode : Mode.values()) { | |
System.out.printf("%-16s { new: %5b, edit: %5b, confirm: %5b, yet another: %5b }\n", | |
mode.name(), | |
mode.isNew(), | |
mode.isEdit(), |
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 Main { | |
public static void main(String[] args) { | |
for (final Mode mode : Mode.values()) { | |
System.out.printf("%-16s { new: %5b, edit: %5b, confirm: %5b, yet another: %5b }\n", | |
mode.name(), | |
mode.isNew(), | |
mode.isEdit(), | |
mode.isConfirm(), | |
mode.isYetAnother()); | |
} |