Skip to content

Commit f00e8b3

Browse files
author
Alejandro Gervasio
committed
Update pom.xml
2 parents a5d4d9e + 9060d6c commit f00e8b3

498 files changed

Lines changed: 11310 additions & 2257 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: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,22 @@
22
The "REST with Spring" Classes
33
==============================
44

5-
Here's the Master Class of REST With Spring (price changes permanently next Friday): <br/>
6-
**[>> THE REST WITH SPRING MASTER CLASS](http://www.baeldung.com/rest-with-spring-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=rws#master-class)**
5+
Here's the Master Class of REST With Spring (along with the newly announced Boot 2 material): <br/>
6+
**[>> THE REST WITH SPRING - MASTER CLASS](http://www.baeldung.com/rest-with-spring-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=rws#master-class)**
77

88
And here's the Master Class of Learn Spring Security: <br/>
9-
**[>> LEARN SPRING SECURITY MASTER CLASS](http://www.baeldung.com/learn-spring-security-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=lss#master-class)**
9+
**[>> LEARN SPRING SECURITY - MASTER CLASS](http://www.baeldung.com/learn-spring-security-course?utm_source=github&utm_medium=social&utm_content=tutorials&utm_campaign=lss#master-class)**
1010

1111

1212

13-
Spring Tutorials
13+
Java and Spring Tutorials
1414
================
1515

16-
This project is **a collection of small and focused tutorials** each covering a single and well defined area of development.
17-
Most of the tutorial projects are focused on the `Spring Framework` (and `Spring Security`).
16+
This project is **a collection of small and focused tutorials** - each covering a single and well defined area of development in the Java ecosystem.
17+
A strong focus of these is, of course, the Spring Framework - Spring, Spring Boot and Spring Securiyt.
1818
In additional to Spring, the following technologies are in focus: `core Java`, `Jackson`, `HttpClient`, `Guava`.
1919

20+
2021
Building the project
2122
====================
2223
To do the full build, do: `mvn install -Pdefault -Dgib.enabled=false`
23-
24-
25-
Working with the code in Eclipse
26-
================================
27-
Any IDE can be used to work with the projects, but if you're using Eclipse, consider the following.
28-
29-
- import the included **formatter** in Eclipse:
30-
`https://github.com/eugenp/tutorials/tree/master/eclipse`
31-
32-
33-
CI - Jenkins
34-
================================
35-
This tutorials project is being built **[>> HERE](https://rest-security.ci.cloudbees.com/job/tutorials-unit/)**
36-
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@
2424
- [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity)
2525
- [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element)
2626
- [An Introduction to the Theory of Big-O Notation](http://www.baeldung.com/big-o-notation)
27+
- [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap)
28+
- [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points)
29+
- [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines)
30+
- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters)

‎algorithms/src/main/java/com/baeldung/algorithms/kthlargest/FindKthLargest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public int findKthElementByRandomizedQuickSelect(Integer[] arr, int left, int ri
9898

9999
private int randomPartition(Integer arr[], int left, int right) {
100100
int n = right - left + 1;
101-
int pivot = (int) (Math.random()) % n;
101+
int pivot = (int) (Math.random() * n);
102102
swap(arr, left + pivot, right);
103103
return partition(arr, left, right);
104104
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.baeldung.algorithms.mergesort;
2+
3+
public class MergeSort {
4+
5+
public static void main(String[] args) {
6+
int[] a = { 5, 1, 6, 2, 3, 4 };
7+
mergeSort(a, a.length);
8+
for (int i = 0; i < a.length; i++)
9+
System.out.println(a[i]);
10+
}
11+
12+
public static void mergeSort(int[] a, int n) {
13+
if (n < 2)
14+
return;
15+
int mid = n / 2;
16+
int[] l = new int[mid];
17+
int[] r = new int[n - mid];
18+
19+
for (int i = 0; i < mid; i++) {
20+
l[i] = a[i];
21+
}
22+
for (int i = mid; i < n; i++) {
23+
r[i - mid] = a[i];
24+
}
25+
mergeSort(l, mid);
26+
mergeSort(r, n - mid);
27+
28+
merge(a, l, r, mid, n - mid);
29+
}
30+
31+
public static void merge(int[] a, int[] l, int[] r, int left, int right) {
32+
33+
int i = 0, j = 0, k = 0;
34+
35+
while (i < left && j < right) {
36+
37+
if (l[i] < r[j])
38+
a[k++] = l[i++];
39+
else
40+
a[k++] = r[j++];
41+
42+
}
43+
44+
while (i < left)
45+
a[k++] = l[i++];
46+
47+
while (j < right)
48+
a[k++] = r[j++];
49+
}
50+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.baeldung.algorithms.quicksort;
2+
3+
public class QuickSort {
4+
5+
public static void quickSort(int arr[], int begin, int end)
6+
{
7+
if (begin < end) {
8+
int partitionIndex = partition(arr, begin, end);
9+
10+
// Recursively sort elements of the 2 sub-arrays
11+
quickSort(arr, begin, partitionIndex-1);
12+
quickSort(arr, partitionIndex+1, end);
13+
}
14+
}
15+
16+
private static int partition(int arr[], int begin, int end)
17+
{
18+
int pivot = arr[end];
19+
int i = (begin-1);
20+
21+
for (int j=begin; j<end; j++)
22+
{
23+
if (arr[j] <= pivot) {
24+
i++;
25+
26+
int swapTemp = arr[i];
27+
arr[i] = arr[j];
28+
arr[j] = swapTemp;
29+
}
30+
}
31+
32+
int swapTemp = arr[i+1];
33+
arr[i+1] = arr[end];
34+
arr[end] = swapTemp;
35+
36+
return i+1;
37+
}
38+
39+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.baeldung.algorithms.quicksort;
2+
3+
public class ThreeWayQuickSort {
4+
5+
public static void threeWayQuickSort(int[] a, int begin, int end)
6+
{
7+
if (end <= begin) return;
8+
9+
// partition
10+
int i = begin;
11+
int less = begin;
12+
int greater = end;
13+
14+
while (i <= greater){
15+
if (a[i] < a[less]) {
16+
int tmp = a[i];
17+
a[i] = a[less];
18+
a[less] = tmp;
19+
20+
i++;
21+
less++;
22+
}
23+
else if (a[less] < a[i]) {
24+
int tmp = a[i];
25+
a[i] = a[greater];
26+
a[greater] = tmp;
27+
28+
greater--;
29+
}
30+
else {
31+
i++;
32+
}
33+
}
34+
35+
threeWayQuickSort(a, begin, less - 1);
36+
threeWayQuickSort(a, greater + 1, end);
37+
}
38+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.baeldung.algorithms.mergesort;
2+
3+
import org.junit.Assert;
4+
5+
import org.junit.Test;
6+
7+
public class MergeSortUnitTest {
8+
9+
@Test
10+
public void positiveTest() {
11+
int[] actual = { 5, 1, 6, 2, 3, 4 };
12+
int[] expected = { 1, 2, 3, 4, 5, 6 };
13+
MergeSort.mergeSort(actual, actual.length);
14+
Assert.assertArrayEquals(expected, actual);
15+
}
16+
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.baeldung.algorithms.quicksort;
2+
3+
import com.baeldung.algorithms.quicksort.QuickSort;
4+
import org.junit.Assert;
5+
import org.junit.Test;
6+
7+
public class QuickSortUnitTest {
8+
9+
@Test
10+
public void givenIntegerArray_whenSortedWithQuickSort_thenGetSortedArray() {
11+
int[] actual = { 9, 5, 1, 0, 6, 2, 3, 4, 7, 8 };
12+
int[] expected = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
13+
QuickSort.quickSort(actual, 0, actual.length-1);
14+
Assert.assertArrayEquals(expected, actual);
15+
}
16+
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.baeldung.algorithms.quicksort;
2+
3+
import org.junit.Assert;
4+
import org.junit.Test;
5+
6+
public class ThreeWayQuickSortUnitTest {
7+
8+
@Test
9+
public void givenIntegerArray_whenSortedWithThreeWayQuickSort_thenGetSortedArray() {
10+
int[] actual = { 3, 5, 5, 5, 3, 7, 7, 3, 5, 5, 7, 3, 3 };
11+
int[] expected = { 3, 3, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7 };
12+
ThreeWayQuickSort.threeWayQuickSort(actual, 0, actual.length-1);
13+
Assert.assertArrayEquals(expected, actual);
14+
}
15+
}

animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppTest.java renamed to animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppUnitTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
/**
88
* Unit test for simple App.
99
*/
10-
public class AppTest
10+
public class AppUnitTest
1111
extends TestCase
1212
{
1313
/**
1414
* Create the test case
1515
*
1616
* @param testName name of the test case
1717
*/
18-
public AppTest( String testName )
18+
public AppUnitTest( String testName )
1919
{
2020
super( testName );
2121
}
@@ -25,7 +25,7 @@ public AppTest( String testName )
2525
*/
2626
public static Test suite()
2727
{
28-
return new TestSuite( AppTest.class );
28+
return new TestSuite( AppUnitTest.class );
2929
}
3030

3131
/**

0 commit comments

Comments
 (0)