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
import java.util.List; | |
// Visitor interface | |
interface ShapeVisitor<T> { | |
T visit(Circle circle); | |
T visit(Rectangle rectangle); | |
T visit(Triangle triangle); | |
T visit(Pentagon pentagon); | |
} |
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
import java.util.List; | |
sealed interface Shape permits Circle, Rectangle, Triangle, Pentagon {} | |
record Circle(double radius) implements Shape {} | |
record Rectangle(double width, double height) implements Shape {} | |
record Triangle(double side1, double side2, double side3) implements Shape {} | |
record Pentagon(double side) implements Shape {} |
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
import scala.annotation.tailrec | |
val sentence = "Four score and ten years ago our fathers brought forth upon this " + | |
"continent a new nation conceived in liberty and dedicated to the " + | |
"proposition that all men are created equal" | |
def wrap(source: String, len: Int):String = { | |
val wordChunks = sentence.split(" ").flatMap(x => x.grouped(len)).toList |
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 config; | |
import orders.commandhandling.Order; | |
import orders.commandhandling.OrderCommandHandler; | |
import org.axonframework.commandhandling.CommandBus; | |
import org.axonframework.commandhandling.SimpleCommandBus; | |
import org.axonframework.commandhandling.annotation.AnnotationCommandHandlerBeanPostProcessor; | |
import org.axonframework.commandhandling.gateway.CommandGatewayFactoryBean; | |
import org.axonframework.eventhandling.EventBus; | |
import org.axonframework.eventhandling.SimpleEventBus; |
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
//JPA enitiy called UserAccount | |
@Entity | |
public class UserAccount { | |
@Id | |
private Long id; | |
private String username; | |
...... | |
} | |
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 models | |
import scala.slick.driver.H2Driver.simple._ | |
import scala.slick.session.Session | |
/** | |
* Created with IntelliJ IDEA. | |
* User: Magnus.Smith | |
* Date: 21/01/13 | |
* Time: 16:20 |