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
- hosts: localhost | |
tasks: | |
- name: Server group | |
jcli_servergroup: | |
jboss_home: /Users/it-ops/Documents/java_dev/server/wildfly-10.0.0.Final/ | |
server_group_name: group1 | |
state: present | |
register: hasil |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.rurocker.example</groupId> | |
<artifactId>demo</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>war</packaging> |
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
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.boot.web.support.SpringBootServletInitializer; | |
@SpringBootApplication | |
public class DemoApplication extends SpringBootServletInitializer{ | |
public static void main(String[] args) { | |
SpringApplication.run(DemoApplication.class, args); | |
} |
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
# data container, bind volume | |
docker run -d --name bmweb -v ~/example-docs:/usr/local/apache2/htdocs -p 80:80 httpd:latest | |
# data container, managed volume | |
docker run -d --volume /var/lib/cassandra/data --name cass-shared alpine echo Data Container | |
# copy volume definitiion from cass-shared | |
docker run -d --volumes-from cass-shared --name cass1 cassandra:2.2 | |
# delete any managed volumes referenced by the target container |
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
//Stream from Collection | |
List<String> list = new ArrayList<>(); | |
list.add("s1"); | |
list.add("s2"); | |
list.add("s3"); | |
list.stream() | |
.map( s -> "From collection " + s) | |
.forEach(System.out::println); | |
//Stream from Arrays class |
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
Random random = new Random(); | |
List<Integer> list = new ArrayList<>(); | |
//create a list of random integers using stream. | |
//Don't have to be like this, just to show off | |
//because we are talking about stream | |
List<Integer> list = IntStream.range(0, 20) | |
.map(i -> random.nextInt(100)) | |
.boxed() //turns IntStream into Stream<Integer> | |
.collect(Collectors.toList()); //will be discussed in advance stream usage |
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
list.stream() | |
.filter(i -> i % 2 == 0) | |
.map(i -> i * i) | |
.sorted() | |
.distinct() | |
.forEach(System.out::println); |
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
public class Car { | |
private String model; | |
private String color; | |
private Double price; | |
public Car(String model, String color, Double price) { | |
this.model = model; | |
this.color = color; | |
this.price = price; |
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
Car car1 = new Car("BMW","Red", 35000d); | |
Car car2 = new Car("BMW","Green", 35500d); | |
Car car3 = new Car("Ford","Yellow", 25000d); | |
Car car4 = new Car("Toyota","Red", 10000d); | |
//populate car model list whose have red values | |
List<String> redCars = Stream.of(car1, car2, car3, car4) | |
.filter(s -> s.getColor().equals("Red") ) //get all cars with red values | |
.map(c -> c.getModel()) //map to get the model only | |
.collect(Collectors.toList()); |
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
//there is at least one negative number | |
public void anyMatch(){ | |
boolean anyMatch; | |
anyMatch = IntStream.of(-1,2,3,5,7,9) | |
.anyMatch(i -> i < 0); | |
System.out.format("It is [%b] that at least one negative number \n", | |
anyMatch); | |
//Output: It is [true] that at least one negative number |
OlderNewer