Skip to content

Instantly share code, notes, and snippets.

View albihasani94's full-sized avatar
:shipit:

Albin Hasani albihasani94

:shipit:
View GitHub Profile
@albihasani94
albihasani94 / staticFactoryMethods.jsh
Last active October 19, 2019 20:28
JShell transcript with static factory methods for lists and sets in Java 9
List<String> animals = new ArrayList<>();
animals.add("Dog");
animals.add("Lemur");
animals.add("Duck");
System.out.println(animals);
Set<String> animals = new HashSet<>(Arrays.asList("Dog", "Lemur", "Duck"));
System.out.println(animals);
Set<String> animals = new HashSet<>(){{add("Dog"); add("Lemur"); add("Duck");}};
System.out.println(animals);
List<String> animals = List.of("Dog", "Lemur", "Duck");
@albihasani94
albihasani94 / ApplicationTest.java
Last active July 1, 2018 21:21
Thorntail 2.0 with Arquillian 1.2.1.Final
package org.wildfly.swarm.jaxrs.rest;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.jboss.arquillian.container.test.api.Deployment;
@albihasani94
albihasani94 / ApplicationTest.java
Last active July 1, 2018 21:20
Thorntail 2.0 with Arquillian 1.3.0.Final
package org.wildfly.swarm.jaxrs.rest;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.jboss.arquillian.container.test.api.Deployment;