Skip to content

Instantly share code, notes, and snippets.

Vojtech Ruzicka vojtechruz

Block or report user

Report or block vojtechruz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View graphml
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:y="http://www.yworks.com/xml/graphml"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key for="node" id="d0" yfiles.type="nodegraphics"/>
<key for="edge" id="d1" yfiles.type="edgegraphics"/>
<graph id="dependencies" edgedefault="directed">
<node id="1364058917">
<data key="d0">
<y:ShapeNode>
View SeparateBuilderExample.java
PersonBuilder builder = new PersonBuilder();
Person bob = builder.firstName("Bob")
.lastName("Builder")
.age(33)
.description("Man, I love building stuff!")
.build();
@vojtechruz
vojtechruz / InnerBuilderExample.java
Created May 11, 2016
Example of Builder as an inner static class. Enclosing class has private constructor, which prevents direct instantiation and allows creation only trough the uilder.
View InnerBuilderExample.java
public class Person {
private final String firstName;
private final String lastName;
private final String description;
private final int age;
private Person(Builder builder) {
firstName = builder.firstName;
lastName = builder.lastName;
@vojtechruz
vojtechruz / TelescopingConstructorExample.java
Last active May 11, 2016
Example of telescoping constructor
View TelescopingConstructorExample.java
public class Person {
private final String firstName;
private final String lastName;
private final String description;
private final int age;
public Person(String firstName, String lastName) {
this(firstName, lastName, "No description available");
}
@vojtechruz
vojtechruz / JavaBeansExample.java
Last active May 11, 2016
Example of JavaBeans Convention
View JavaBeansExample.java
private Person john = new Person();
john.setFirstName("John");
john.setLastName("Smith");
john.setAge(33);
john.setDescription("I am a huge fan on JavaBeans convention!");
You can’t perform that action at this time.