Important
|
make sure to have kotlinc on your $PATH |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
'use strict' | |
var eventDetails = function(element, event) { | |
event.stopPropagation ? event.stopPropagation() : (event.cancelBubble = true); | |
console.log("target.id:" + event.target.id + ", this.id:" + element.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 rs.dodalovic.streams.flap_map; | |
import java.util.List; | |
public class Developer { | |
private final String name; | |
private final List<String> programmingLanguages; | |
public Developer(String name, List<String> programmingLanguages) { | |
this.name = name; |
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 rs.dodalovic.design_patterns.behavioral.strategy.user_persistence; | |
class User { | |
private final int id; | |
private final String username; | |
private final String location; | |
public User(int id, String username, String location) { | |
this.id = id; | |
this.username = username; |
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 rs.dodalovic.send_mail; | |
import org.apache.commons.mail.EmailException; | |
import org.apache.commons.mail.HtmlEmail; | |
import javax.mail.util.ByteArrayDataSource; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.nio.charset.StandardCharsets; |
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 rs.dodalovic.streams.reduce; | |
class Person { | |
private String name; | |
private Gender gender; | |
private Integer age; | |
public Person(String name, Gender gender, Integer age) { | |
this.name = name; | |
this.gender = gender; |
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.mydomain; | |
import org.junit.Test; | |
import org.mockito.Mockito; | |
import java.util.Optional; | |
import static org.assertj.core.api.Assertions.assertThat; | |
import static org.mockito.Mockito.*; |
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 rs.dodalovic.streams.collect.collectors_api; | |
import rs.dodalovic.fn_interfaces.predicate.persons_test.Person; | |
import java.util.*; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
import static java.util.stream.Collectors.*; |
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
sealed class Student(val indexNumber: String) | |
class GraduateStudent(indexNumber: String, val graduationYear: Int) : Student(indexNumber) | |
class UnderGraduateStudent(indexNumber: String, val currentGrade: Int) : Student(indexNumber) | |
fun main(args: Array<String>) { | |
val student: Student = UnderGraduateStudent("123", 3) | |
when (student) { | |
is UnderGraduateStudent -> println("UnderGraduateStudent :: indexNumber: ${student.indexNumber} :: current grade : ${student.currentGrade}") | |
is GraduateStudent -> println("GraduateStudent :: indexNumber: ${student.indexNumber} :: graduation year : $ { student.currentGrade}") |
OlderNewer