Skip to content

Commit ce589cc

Browse files
daveRanjanpivovarit
authored andcommitted
Corrected Indentation using formatter. (eugenp#1541)
1 parent e28dfe6 commit ce589cc

14 files changed

Lines changed: 119 additions & 145 deletions

‎guava21/src/main/java/com/baeldung/guava/tutorial/AtomicLongMapTutorials.java‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ public class AtomicLongMapTutorials {
66

77
private AtomicLongMap<String> atomicLongMap;
88

9-
public AtomicLongMapTutorials(){
9+
public AtomicLongMapTutorials() {
1010
atomicLongMap = AtomicLongMap.create();
1111
}
1212

13-
14-
public void addKeys(){
15-
atomicLongMap.addAndGet("apple",250);
16-
atomicLongMap.addAndGet("bat",350);
17-
atomicLongMap.addAndGet("cat",450);
18-
atomicLongMap.addAndGet("dog",550);
13+
public void addKeys() {
14+
atomicLongMap.addAndGet("apple", 250);
15+
atomicLongMap.addAndGet("bat", 350);
16+
atomicLongMap.addAndGet("cat", 450);
17+
atomicLongMap.addAndGet("dog", 550);
1918
}
2019

21-
public static void main(String[] args){
20+
public static void main(String[] args) {
2221
AtomicLongMapTutorials atomicLongMapTutorials = new AtomicLongMapTutorials();
2322
atomicLongMapTutorials.addKeys();
2423

‎guava21/src/main/java/com/baeldung/guava/tutorial/ComparatorsExamples.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88

99
public class ComparatorsExamples {
1010

11-
public static void main(String[] args){
11+
public static void main(String[] args) {
1212

13-
List<Integer> integers = Arrays.asList(1,2,3,4,4,6,7,8,9,10);
14-
//This will return true
13+
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 4, 6, 7, 8, 9, 10);
1514
boolean isInAscendingOrder = Comparators.isInOrder(integers, new AscedingOrderComparator());
16-
1715
System.out.println(isInAscendingOrder);
1816

1917
}

‎guava21/src/main/java/com/baeldung/guava/tutorial/ConcatStreams.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java.util.stream.Stream;
66

77
public class ConcatStreams {
8-
public static Stream concatStreams(Stream stream1, Stream stream2, Stream stream3){
9-
return Streams.concat(stream1,stream2,stream3);
8+
public static Stream concatStreams(Stream stream1, Stream stream2, Stream stream3) {
9+
return Streams.concat(stream1, stream2, stream3);
1010
}
1111
}

‎guava21/src/main/java/com/baeldung/guava/tutorial/InternerBuilderExample.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33
import com.google.common.collect.Interner;
44
import com.google.common.collect.Interners;
55

6-
import static com.google.common.collect.Interners.newBuilder;
7-
86
public class InternerBuilderExample {
97

10-
public static void main(String[] args){
11-
Interner<Integer> interners = Interners.<Integer>newBuilder()
12-
.concurrencyLevel(2)
13-
.strong()
14-
.<Integer>build();
15-
8+
public static void main(String[] args) {
9+
Interner<Integer> interners = Interners.<Integer> newBuilder()
10+
.concurrencyLevel(2)
11+
.strong().<Integer> build();
1612

1713
}
1814

‎guava21/src/main/java/com/baeldung/guava/tutorial/MonitorExample.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
import java.util.ArrayList;
66
import java.util.List;
7-
import java.util.function.BooleanSupplier;
87

98
public class MonitorExample {
109
private List<String> students = new ArrayList<String>();
1110
private static final int MAX_SIZE = 100;
1211

1312
private Monitor monitor = new Monitor();
1413

15-
1614
public void addToCourse(String item) throws InterruptedException {
1715
Monitor.Guard studentsBelowCapacity = monitor.newGuard(this::isStudentsCapacityUptoLimit);
1816
monitor.enterWhen(studentsBelowCapacity);
@@ -23,7 +21,7 @@ public void addToCourse(String item) throws InterruptedException {
2321
}
2422
}
2523

26-
public Boolean isStudentsCapacityUptoLimit(){
24+
public Boolean isStudentsCapacityUptoLimit() {
2725
return students.size() > MAX_SIZE;
2826
}
2927
}

‎guava21/src/main/java/com/baeldung/guava/tutorial/MoreCollectorsExample.java‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ public class MoreCollectorsExample {
1010

1111
public static void main(String[] args) {
1212
List<Integer> numbers = Arrays.asList(1);
13-
Optional<Integer> number = numbers.stream()
14-
.map(e -> e * 2)
15-
.collect(MoreCollectors.toOptional());
13+
Optional<Integer> number = numbers
14+
.stream()
15+
.map(e -> e * 2)
16+
.collect(MoreCollectors.toOptional());
1617
}
1718
}

‎guava21/src/main/java/com/baeldung/guava/tutorial/StreamsUtility.java‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
public class StreamsUtility {
1212

13-
public static void main(String[] args){
13+
public static void main(String[] args) {
1414

15-
List<Integer> numbers = Arrays.asList(1,2,3,4,5,6,7,8,9,10,11,11,12,13,14,15,16,17,18,19,20);
15+
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
1616
//Using Collection
1717
Stream<Integer> streamFromCollection = Streams.stream(numbers);
1818
//Using Iterator
@@ -28,15 +28,12 @@ public static void main(String[] args){
2828
//Using OptionalDouble to DoubleStream
2929
DoubleStream streamFromOptionalDouble = Streams.stream(OptionalDouble.of(1.0));
3030

31-
Stream<Integer> concatenatedStreams = Streams.concat(streamFromCollection,streamFromIterable,streamFromIterator);
31+
Stream<Integer> concatenatedStreams = Streams.concat(streamFromCollection, streamFromIterable, streamFromIterator);
3232

33-
List<Integer> integers = Arrays.asList(1,2,3,4,5,6,7,8,9,10);
33+
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
3434
//This will return 10
3535
Optional<Integer> lastItem = Streams.findLast(integers.stream());
3636

37-
Streams.zip(
38-
Stream.of("candy", "chocolate", "bar"),
39-
Stream.of("$1", "$2","$3"),
40-
(arg1, arg2) -> arg1 + ":" + arg2);
37+
Streams.zip(Stream.of("candy", "chocolate", "bar"), Stream.of("$1", "$2", "$3"), (arg1, arg2) -> arg1 + ":" + arg2);
4138
}
4239
}
Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import com.google.common.util.concurrent.AtomicLongMap;
2-
import org.junit.Assert;
32
import org.junit.Test;
43

54
import static org.junit.Assert.assertEquals;
@@ -12,53 +11,44 @@ public class AtomicLongMapTests {
1211

1312
AtomicLongMap<String> courses = AtomicLongMap.create();
1413

15-
public void setUp(){
14+
public void setUp() {
1615
courses.put(SPRING_COURSE_KEY, 1056);
1716
courses.put(HIBERNATE_COURSE_KEY, 259);
1817
courses.put(GUAVA_COURSE_KEY, 78);
1918
}
2019

20+
@Test
21+
public void accumulateAndGet_withLongBinaryOperator_thenSuccessful() {
22+
long noOfStudents = 56;
23+
long oldValue = courses.get(SPRING_COURSE_KEY);
2124

22-
@Test
23-
public void accumulateAndGet_withLongBinaryOperator_thenSuccessful(){
24-
long noOfStudents = 56;
25-
long oldValue = courses.get(SPRING_COURSE_KEY);
26-
27-
long totalNotesRequired = courses.accumulateAndGet(
28-
"Guava",
29-
noOfStudents,
30-
(x,y) -> (x * y));
25+
long totalNotesRequired = courses.accumulateAndGet("Guava", noOfStudents, (x, y) -> (x * y));
3126

32-
assertEquals(totalNotesRequired, oldValue * noOfStudents );
33-
}
27+
assertEquals(totalNotesRequired, oldValue * noOfStudents);
28+
}
3429

3530
@Test
36-
public void getAndAccumulate_withLongBinaryOperator_thenSuccessful(){
31+
public void getAndAccumulate_withLongBinaryOperator_thenSuccessful() {
3732
long noOfStudents = 56;
3833
long beforeUpdate = courses.get(SPRING_COURSE_KEY);
3934

40-
long onUpdate = courses.accumulateAndGet("Guava",
41-
noOfStudents,
42-
(x,y) -> (x * y)
43-
);
35+
long onUpdate = courses.accumulateAndGet("Guava", noOfStudents, (x, y) -> (x * y));
4436

4537
long afterUpdate = courses.get(SPRING_COURSE_KEY);
4638

4739
assertEquals(onUpdate, afterUpdate);
4840
assertEquals(afterUpdate, beforeUpdate * noOfStudents);
4941
}
5042

51-
@Test
52-
public void updateAndGet_withLongUnaryOperator_thenSuccessful(){
53-
long beforeUpdate = courses.get(SPRING_COURSE_KEY);
43+
@Test
44+
public void updateAndGet_withLongUnaryOperator_thenSuccessful() {
45+
long beforeUpdate = courses.get(SPRING_COURSE_KEY);
5446

55-
long onUpdate = courses.updateAndGet(
56-
"Guava",
57-
(x) -> (x/2));
47+
long onUpdate = courses.updateAndGet("Guava", (x) -> (x / 2));
5848

59-
long afterUpdate = courses.get(SPRING_COURSE_KEY);
49+
long afterUpdate = courses.get(SPRING_COURSE_KEY);
6050

61-
assertEquals(onUpdate, afterUpdate);
62-
assertEquals(afterUpdate, beforeUpdate/2);
63-
}
51+
assertEquals(onUpdate, afterUpdate);
52+
assertEquals(afterUpdate, beforeUpdate / 2);
53+
}
6454
}

‎guava21/src/test/java/ComparatorsUnitTests.java‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import org.junit.Assert;
33
import org.junit.Test;
44

5-
import java.util.*;
5+
import java.util.Arrays;
6+
import java.util.Comparator;
7+
import java.util.List;
68
import java.util.function.Function;
79
import java.util.function.ToDoubleFunction;
810
import java.util.function.ToIntFunction;
@@ -11,27 +13,26 @@
1113
public class ComparatorsUnitTests {
1214

1315
@Test
14-
public void isInOrderTest(){
16+
public void isInOrderTest() {
1517

16-
List<Integer> numbers = Arrays.asList(1,2,3,4,4,6,7,8,9,10);
18+
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 4, 6, 7, 8, 9, 10);
1719

1820
boolean isInAscendingOrder = Comparators.isInOrder(numbers, new AscendingOrderComparator<Number>());
1921

2022
Assert.assertTrue(isInAscendingOrder);
2123
}
2224

2325
@Test
24-
public void isInStrictOrderTest(){
26+
public void isInStrictOrderTest() {
2527

26-
List<Integer> numbers = Arrays.asList(1,2,3,4,3,6,7,8,9,10);
28+
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 3, 6, 7, 8, 9, 10);
2729

2830
boolean isInAscendingOrder = Comparators.isInOrder(numbers, new AscendingOrderComparator<Number>());
2931

3032
Assert.assertFalse(isInAscendingOrder);
3133
}
3234

33-
34-
private class AscendingOrderComparator<I extends Number> implements Comparator<Integer>{
35+
private class AscendingOrderComparator<I extends Number> implements Comparator<Integer> {
3536

3637
@Override
3738
public int compare(Integer o1, Integer o2) {

0 commit comments

Comments
 (0)