Skip to content

Commit bf04c6b

Browse files
Merge remote-tracking branch 'upstream/master' into BAEL-1657
2 parents 8d05a42 + 1b8a00e commit bf04c6b

271 files changed

Lines changed: 5236 additions & 1519 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ CI - Jenkins
3434
================================
3535
This tutorials project is being built **[>> HERE](https://rest-security.ci.cloudbees.com/job/tutorials-unit/)**
3636

37+
### Relevant Articles:
38+
================================
39+
40+
- [Apache Maven Standard Directory Layout](http://www.baeldung.com/maven-directory-structure)
41+
- [Apache Maven Tutorial](http://www.baeldung.com/maven)
42+
- [Designing a User Friendly Java Library](http://www.baeldung.com/design-a-user-friendly-java-library)

‎algorithms/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
- [A Maze Solver in Java](http://www.baeldung.com/java-solve-maze)
2121
- [Create a Sudoku Solver in Java](http://www.baeldung.com/java-sudoku)
2222
- [Displaying Money Amounts in Words](http://www.baeldung.com/java-money-into-words)
23-
- [A Collaborative Filtering Recommendation System in Java](http://www.baeldung.com/java-collaborative-filtering-recommendations)
23+
- [A Collaborative Filtering Recommendation System in Java](http://www.baeldung.com/java-collaborative-filtering-recommendations)
24+
- [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum)

‎asciidoctor/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
- [Introduction to Asciidoctor](http://www.baeldung.com/introduction-to-asciidoctor)
44
- [Generating a Book with Asciidoctor](http://www.baeldung.com/asciidoctor-book)
5+
- [Introduction to Asciidoctor in Java](http://www.baeldung.com/asciidoctor)

‎aws/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
- [Multipart Uploads in Amazon S3 with Java](http://www.baeldung.com/aws-s3-multipart-upload)
99
- [Integration Testing with a Local DynamoDB Instance](http://www.baeldung.com/dynamodb-local-integration-tests)
1010
- [Using the JetS3t Java Client With Amazon S3](http://www.baeldung.com/jets3t-amazon-s3)
11+
- [Managing Amazon SQS Queues in Java](http://www.baeldung.com/aws-queues-java)
1112

‎cdi/pom.xml‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@
88

99
<parent>
1010
<groupId>com.baeldung</groupId>
11-
<artifactId>parent-modules</artifactId>
12-
<version>1.0.0-SNAPSHOT</version>
11+
<artifactId>parent-spring</artifactId>
12+
<version>0.0.1-SNAPSHOT</version>
13+
<relativePath>../parent-spring</relativePath>
1314
</parent>
1415

1516
<dependencies>
16-
<dependency>
17-
<groupId>org.springframework</groupId>
18-
<artifactId>spring-core</artifactId>
19-
<version>${spring.version}</version>
20-
</dependency>
2117
<dependency>
2218
<groupId>org.springframework</groupId>
2319
<artifactId>spring-context</artifactId>

‎core-groovy/pom.xml‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
<artifactId>groovy-sql</artifactId>
2929
<version>${groovy-sql.version}</version>
3030
</dependency>
31-
<dependency>
32-
<groupId>org.junit.jupiter</groupId>
33-
<artifactId>junit-jupiter-engine</artifactId>
34-
<version>${junit.jupiter.version}</version>
35-
<scope>test</scope>
36-
</dependency>
3731
<dependency>
3832
<groupId>org.junit.platform</groupId>
3933
<artifactId>junit-platform-runner</artifactId>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.baeldung.java10;
2+
3+
import static org.hamcrest.CoreMatchers.is;
4+
import static org.junit.Assert.assertFalse;
5+
import static org.junit.Assert.assertTrue;
6+
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
import java.util.stream.Collectors;
10+
11+
import org.junit.Before;
12+
import org.junit.Test;
13+
14+
public class Java10FeaturesUnitTest {
15+
16+
private List<Integer> someIntList;
17+
18+
@Before
19+
public void setup() {
20+
someIntList = new ArrayList<>();
21+
22+
someIntList.add(1);
23+
someIntList.add(2);
24+
someIntList.add(3);
25+
}
26+
27+
@Test
28+
public void whenVarInitWithString_thenGetStringTypeVar() {
29+
var message = "Hello, Java 10";
30+
assertTrue(message instanceof String);
31+
}
32+
33+
@Test
34+
public void whenVarInitWithAnonymous_thenGetAnonymousType() {
35+
var obj = new Object() {};
36+
assertFalse(obj.getClass().equals(Object.class));
37+
}
38+
39+
@Test(expected = UnsupportedOperationException.class)
40+
public void whenModifyCopyOfList_thenThrowsException() {
41+
List<Integer> copyList = List.copyOf(someIntList);
42+
copyList.add(4);
43+
}
44+
45+
@Test(expected = UnsupportedOperationException.class)
46+
public void whenModifyToUnmodifiableList_thenThrowsException() {
47+
List<Integer> evenList = someIntList.stream()
48+
.filter(i -> i % 2 == 0)
49+
.collect(Collectors.toUnmodifiableList());
50+
evenList.add(4);
51+
}
52+
53+
@Test
54+
public void whenListContainsInteger_OrElseThrowReturnsInteger() {
55+
Integer firstEven = someIntList.stream()
56+
.filter(i -> i % 2 == 0)
57+
.findFirst()
58+
.orElseThrow();
59+
is(firstEven).equals(Integer.valueOf(2));
60+
}
61+
}

‎core-java-8/README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
- [Overview of Java Built-in Annotations](http://www.baeldung.com/java-default-annotations)
4848
- [Finding Min/Max in an Array with Java](http://www.baeldung.com/java-array-min-max)
4949
- [Internationalization and Localization in Java 8](http://www.baeldung.com/java-8-localization)
50+
- [Filtering Kotlin Collections](http://www.baeldung.com/kotlin-filter-collection)
51+
- [How to Find an Element in a List with Java](http://www.baeldung.com/find-list-element-java)
52+
- [Measure Elapsed Time in Java](http://www.baeldung.com/java-measure-elapsed-time)
53+

‎core-java-8/pom.xml‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@
99

1010
<parent>
1111
<groupId>com.baeldung</groupId>
12-
<artifactId>parent-modules</artifactId>
13-
<version>1.0.0-SNAPSHOT</version>
12+
<artifactId>parent-java</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<relativePath>../parent-java</relativePath>
1415
</parent>
1516

1617
<dependencies>
17-
<!-- utils -->
18-
<dependency>
19-
<groupId>com.google.guava</groupId>
20-
<artifactId>guava</artifactId>
21-
<version>${guava.version}</version>
22-
</dependency>
2318
<dependency>
2419
<groupId>org.apache.commons</groupId>
2520
<artifactId>commons-collections4</artifactId>

‎core-java-collections/pom.xml‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
<name>core-java-collections</name>
99

1010
<parent>
11-
<groupId>com.baeldung</groupId>
12-
<artifactId>parent-modules</artifactId>
13-
<version>1.0.0-SNAPSHOT</version>
14-
</parent>
11+
<groupId>com.baeldung</groupId>
12+
<artifactId>parent-java</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<relativePath>../parent-java</relativePath>
15+
</parent>
1516

1617
<dependencies>
1718
<dependency>
@@ -25,11 +26,6 @@
2526
<artifactId>collections-generic</artifactId>
2627
<version>${collections-generic.version}</version>
2728
</dependency>
28-
<dependency>
29-
<groupId>com.google.guava</groupId>
30-
<artifactId>guava</artifactId>
31-
<version>${guava.version}</version>
32-
</dependency>
3329
<dependency>
3430
<groupId>org.apache.commons</groupId>
3531
<artifactId>commons-collections4</artifactId>
@@ -55,7 +51,6 @@
5551
</dependencies>
5652

5753
<properties>
58-
<guava.version>22.0</guava.version>
5954
<commons-lang3.version>3.5</commons-lang3.version>
6055
<commons-collections4.version>4.1</commons-collections4.version>
6156
<collections-generic.version>4.01</collections-generic.version>

0 commit comments

Comments
 (0)