This file contains hidden or 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 org.shelajev.throwaway.defmeth; | |
| public class Main { | |
| public static void main(String[] args) { | |
| // what does this program produce? | |
| B b = new B(); | |
| b.m1(); | |
| b.callM1(); | |
| b.callSuperM1(); | |
| } |
This file contains hidden or 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 org.shelajev; | |
| public class Main { | |
| public static void main(String[] args) { | |
| System.out.println("Hello World!"); | |
| Thread t = new Thread(); | |
| int a = countInstances(Thread.class); | |
| System.out.println("There are " + a + " instances of " + Thread.class); | |
| } |
This file contains hidden or 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
| # http://bramp.github.io/js-sequence-diagrams/ | |
| DSU solution->Genrih: notifies about upcoming update | |
| Genrih->>DSU solution: request changed classes | |
| DSU solution->Genrih: provides changed classes | |
| Genrih->Diff tool: old code, new code | |
| Diff tool->>Genrih: list of changes | |
| Note right of Genrih: changes => potential phenomena | |
| Genrih->Oracle: list of phenomena | |
| Oracle->Runtime: queries state | |
| Runtime->>Oracle: state information |
This file contains hidden or 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
| @RestController | |
| class ThisWillActuallyRun { | |
| @RequestMapping("/") | |
| String home() { | |
| return "Hello World!" | |
| } | |
| } |
This file contains hidden or 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 Foo { | |
| private String bar; | |
| private int number; | |
| public Foo() { | |
| // Do some stuff | |
| } | |
| public String getBar() { return this.bar; } |
This file contains hidden or 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
| //Default methods in interfaces | |
| @FunctionalInterface | |
| interface Utilities { | |
| default Consumer<Runnable> m() { | |
| return (r) -> r.run(); | |
| } | |
| // default methods, still functional | |
| Object function(Object o); | |
| } | |
This file contains hidden or 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 interface Debuggable { | |
| default String debug() { | |
| StringBuilder sb = new StringBuilder(this.getClass().getName()); | |
| sb.append(" [ "); | |
| Field[] fields = this.getClass().getDeclaredFields(); | |
| for(Field f: fields) { | |
| f.setAccessible(true); | |
| try { | |
| sb.append(f.getName() + " = " + f.get(this)); | |
| sb.append(", "); |
This file contains hidden or 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
| class ExampleActor extends AbstractActor { | |
| // this child will be destroyed and re-created upon restart by default | |
| final ActorRef other = getContext().actorOf(new Props(OtherActor.class), "childName"); | |
| public ExampleActor() { | |
| receive(ReceiveBuilder | |
| .match(Request1.class, r -> | |
| other.tell(r.getMsg(), self()) | |
| ) | |
| .match(Request2.class, r -> |
This file contains hidden or 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
| FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | |
| fab.setOnClickListener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View view) { | |
| Snackbar.make(view, “Super fast hello world”, Snackbar.LENGTH_LONG) | |
| .setAction(“Action”, null).show(); | |
| } | |
| }); |
This file contains hidden or 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
| compile ‘com.squareup.retrofit2:retrofit:2.0.0-beta2’ | |
| compile ‘com.squareup.retrofit2:gson-converter:2.0.0-beta2’ |
OlderNewer