Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
84bcc81
Hexagonal Architecture in Java
Jun 9, 2019
a51abba
Hexagonal Architecture in Java - incorporated feedback
Jun 12, 2019
bfbfa91
Merge pull request #6 from eugenp/master
Maiklins Jun 13, 2019
104daa7
Merge pull request #7 from eugenp/master
Maiklins Jun 25, 2019
bacef5c
BAEL-2999
Jun 27, 2019
ee3acb5
Removing the evaluation article code.
Jun 27, 2019
2ceab19
Corrected indentation for continuations
Jul 3, 2019
d91741c
Merge branch 'eugenmaster'
marcos-lg Jul 16, 2019
a178f09
BAEL-3005 | Validating List objects in Spring
pallavi-priyadarshani Jul 23, 2019
dd7b922
[BAEL-3090] Added example
Jul 24, 2019
83d8443
[BAEL-3090] Added test + removed cursor
Jul 27, 2019
c3cc9a8
[BAEL-3090] Removed Coordinates
Jul 27, 2019
b9089ce
[BAEL-3090] Really added test this time
Jul 27, 2019
dcc8d52
[BAEL-3090] Renamed test to match PMD
Jul 27, 2019
2b602b0
actuator httpTrace endpoint
marcos-lg Jul 28, 2019
07c159d
added synchronization to HttpTraceRepository
marcos-lg Jul 30, 2019
5ada819
Merge branch 'eugenmaster'
marcos-lg Jul 30, 2019
9e7a605
Merge branch 'master' into BAEL-3003-spring-tracing
marcos-lg Jul 30, 2019
8c7ca1f
Added test cases that use @Sql, @SqlConfig and @SqlGroup
Aug 2, 2019
8c44ab9
Merge remote-tracking branch 'upstream/master'
Aug 2, 2019
29adc66
Fixed formating and removed unused files
Aug 2, 2019
98b5a7f
BAEL-3005 | updated exception handler
pallavi-priyadarshani Aug 2, 2019
6123255
BAEL--3005 | updated Movie POJO
pallavi-priyadarshani Aug 2, 2019
de91009
Delete Actor.java
pallavi-priyadarshani Aug 2, 2019
ff21ddb
Delete MovieRepository.java
pallavi-priyadarshani Aug 2, 2019
99fd6d2
Create MovieService.java
pallavi-priyadarshani Aug 2, 2019
90dc6c6
Update MovieController.java
pallavi-priyadarshani Aug 2, 2019
d9abb29
Update CustomConstraint.java
pallavi-priyadarshani Aug 2, 2019
a5f0631
Update CustomConstraintValidator.java
pallavi-priyadarshani Aug 2, 2019
077f38e
Update MovieControllerIntegrationTest.java
pallavi-priyadarshani Aug 2, 2019
e30f8c6
Fixed Test file names as per convention
Aug 2, 2019
e35a802
Fixed Test file names as per convention
Aug 3, 2019
d72ed9a
Added the K-Means related codes.
alimate Aug 4, 2019
f8e37b3
Fixed the compilation failure.
alimate Aug 4, 2019
aa7b95e
BAEL-3115
vatsalgosar Aug 5, 2019
88444ad
refactoring
vatsalgosar Aug 5, 2019
ebfee30
improvements Spring httpTrace + added spring-boot-management to main pom
marcos-lg Aug 5, 2019
b8a8a7f
added spring-boot-management to IT build
marcos-lg Aug 5, 2019
f615f9a
Removed the ML module!
alimate Aug 7, 2019
5a10f94
Fixed formatting issues.
alimate Aug 7, 2019
5e7396b
Fixed the single line if statements.
alimate Aug 7, 2019
cefb7e4
Testcase feedback incorporated (#1)
harshavs Aug 8, 2019
04c742c
[BAEL-16684] - Upgrade parent-boot-2 to the latest version of Boot 2.1.7
amit2103 Aug 8, 2019
3613d25
[BAEL-16683] - Upgrade parent-boot-1 to the latest version of Boot 1.…
amit2103 Aug 8, 2019
cb6306b
Upgraded parent-spring-5 versions, and fixed minor issues in modules …
rozagerardo Aug 10, 2019
b3af5e6
3005 | updated custom constraint and test case
pallavi-priyadarshani Aug 10, 2019
8d8bed2
[BAEL-15958] - Upgraded spring-security-core to Boot 2
amit2103 Aug 10, 2019
5d41031
Fixes the sql2o link.
rpvilao-gymondo Aug 10, 2019
6012245
Fixes the autoconfig tutorial.
rpvilao-gymondo Aug 10, 2019
7c740b7
Fixes the link in the readme file.
rpvilao-gymondo Aug 10, 2019
9867e44
Merge branch 'master' of https://github.com/eugenp/tutorials into BAE…
amit2103 Aug 10, 2019
4751223
BAEL-3118 (#7552)
vatsalgosar Aug 10, 2019
ab3c97f
Merge pull request #7536 from amit2103/BAEL-16684
lor6 Aug 10, 2019
b4be644
Merge pull request #7537 from amit2103/BAEL-16683
lor6 Aug 10, 2019
6668ce9
Merge pull request #7549 from eugenp/fix/sql2o-readme
lor6 Aug 10, 2019
574547c
Merge pull request #7550 from eugenp/fix/autoconfig-tutorial
lor6 Aug 10, 2019
51c1b3d
Merge pull request #7551 from eugenp/fix/BAEL-3087
lor6 Aug 10, 2019
0fbd9eb
BAEL-3122 In-Place Sort (#7542)
cdjole Aug 11, 2019
32127cc
Merge pull request #7515 from vatsalgosar/BAEL-3115
rpvilao Aug 11, 2019
8436475
[BAEL-15990] - Moved properties articles
amit2103 Aug 11, 2019
9cb9386
Add source code for article BAEL-2463 (#7543)
yavuztas Aug 11, 2019
574f0c2
Merge pull request #7554 from amit2103/BAEL-15990
lor6 Aug 11, 2019
04fe870
Merge branch 'master' of https://github.com/eugenp/tutorials into BAE…
amit2103 Aug 11, 2019
e9ee1a5
[BAEL-15958] - Added password encoder
amit2103 Aug 11, 2019
527e4aa
[BAEL-15990] - Moved org.baeldung to com.baeldung
amit2103 Aug 11, 2019
17c7810
Merge pull request #7547 from amit2103/BAEL-15958
lor6 Aug 11, 2019
28e18be
Update MaxSizeConstraintValidator.java
pallavi-priyadarshani Aug 11, 2019
f918e37
Merge pull request #7556 from amit2103/BAEL-15990
lor6 Aug 12, 2019
da94a75
Update README.md
lor6 Aug 12, 2019
53170d6
Merge pull request #4 from eugenp/master
MajewskiKrzysztof Aug 12, 2019
6b1c8c2
BAEL-3125
Aug 12, 2019
7d1499f
BAEL-2947 - Guide to Junit 4 Rules
JonCook Aug 12, 2019
1f10492
BAEL-3038 Add integration tests (#7495)
Aug 12, 2019
16489a1
library-mv-pt-2
sam-tmtc Aug 12, 2019
23cc42b
library move pt 2
sam-tmtc Aug 12, 2019
418064b
added back removed Context Tests
rozagerardo Aug 12, 2019
005dd34
Merge pull request #7468 from harshavs/master
eric-martin Aug 13, 2019
c08db10
Merge pull request #7544 from rozagerardo/rozagerardo/BAEL-16686_PERI…
lor6 Aug 13, 2019
278b4e6
Back-link added
collaboratewithakash Aug 13, 2019
ea62659
Back-link added
collaboratewithakash Aug 13, 2019
ea29227
Back-link added
collaboratewithakash Aug 13, 2019
b953b1b
Back-link added
collaboratewithakash Aug 13, 2019
c7f2df1
Back-link added
collaboratewithakash Aug 13, 2019
c91f3de
Back-link added
collaboratewithakash Aug 13, 2019
81ddcc9
Back-link added
collaboratewithakash Aug 13, 2019
ca32ae3
Back-link added
collaboratewithakash Aug 13, 2019
988f52c
Back-link added
collaboratewithakash Aug 13, 2019
8c96ba2
Back-link added
collaboratewithakash Aug 13, 2019
4fa07af
Back-link added
collaboratewithakash Aug 13, 2019
8d295e2
Back-link added
collaboratewithakash Aug 13, 2019
fc093a8
Back-link added
collaboratewithakash Aug 13, 2019
5466e2f
Back-link added
collaboratewithakash Aug 13, 2019
f992602
Back-link added
collaboratewithakash Aug 13, 2019
7a553f7
Back-link added
collaboratewithakash Aug 13, 2019
5cc5966
Back-link added
collaboratewithakash Aug 13, 2019
b625ebe
Back-link added
collaboratewithakash Aug 13, 2019
6c1364d
Back-link added
collaboratewithakash Aug 13, 2019
06feff9
Back-link added
collaboratewithakash Aug 13, 2019
13f818c
[BAEL-16005] moved articles from libraries to libraries-security and …
sam-tmtc Aug 13, 2019
7885053
[BAEL-16694] - Fixed spring-jooq Integration Tests
amit2103 Aug 13, 2019
8e1d751
BAEL-3040: @TestInstance annotation in JUnit 5 (#7247)
vimde Aug 13, 2019
825a3a8
Create README.md
lor6 Aug 13, 2019
f9a941e
Update README.md
lor6 Aug 13, 2019
78adf3a
Update README.md
lor6 Aug 13, 2019
a6da9ca
Update README.md
lor6 Aug 13, 2019
5806ea3
Update README.MD
lor6 Aug 13, 2019
b57714a
Merge pull request #7566 from collaboratewithakash/master
lor6 Aug 14, 2019
b071032
Merge pull request #7570 from eugenp/lor6-patch-4
lor6 Aug 14, 2019
cc882bd
Merge pull request #7569 from eugenp/lor6-patch-3
lor6 Aug 14, 2019
f34841b
Merge pull request #7559 from eugenp/lor6-patch-2
lor6 Aug 14, 2019
181943a
Merge pull request #7503 from alimate/BAEL-3070
eric-martin Aug 14, 2019
0467201
BAEL-3116: Finding the Least Common Multiple in Java
tapankavasthi Jul 30, 2019
c23cf58
Implemented the code to count words in a string in Java
Alfred-Samanga Aug 14, 2019
f705335
Merge pull request #7560 from MajewskiKrzysztof/BAEL-3125
rpvilao Aug 14, 2019
4ca253f
[BAEL-16780] - Fixed the integrations tests in spring-5-reactive
amit2103 Aug 14, 2019
0dcf126
Added test code for counting words in a string in Java
Alfred-Samanga Aug 14, 2019
e79a285
Bael 3000 (#7384)
smokeyrobot Aug 15, 2019
5a2120c
Create README.md
lor6 Aug 15, 2019
7a80e2e
Update README.md
lor6 Aug 15, 2019
2fc8c1d
Merge pull request #7581 from eugenp/lor6-patch-2
lor6 Aug 15, 2019
c28bfc9
Create README.md
lor6 Aug 15, 2019
e05d0cd
remove extra bin folder from resteasy
lor6 Aug 15, 2019
84b0724
Delete pom.xml
lor6 Aug 15, 2019
0cbc597
Merge pull request #7568 from amit2103/BAEL-16694
lor6 Aug 15, 2019
b3547bc
Merge pull request #7578 from amit2103/BAEL-16780
lor6 Aug 15, 2019
4562a2f
Code example: Using a Mutex Object in Java (#7587)
kamleshkr Aug 16, 2019
d84f97c
InterpolationSearch (#7575)
afshar-mohammad Aug 16, 2019
838a8d4
Merge pull request #7564 from sjmillington/lib-mv-pt-2
lor6 Aug 16, 2019
368f37e
Merge pull request #7567 from sjmillington/library-move-pt-3
lor6 Aug 16, 2019
5e8cc65
Update README.md
lor6 Aug 16, 2019
11adece
Update README.md
lor6 Aug 16, 2019
bd5480e
Update pom.xml
lor6 Aug 16, 2019
c40cd45
Merge pull request #7585 from eugenp/lor6-patch-4
lor6 Aug 16, 2019
68eda2e
Merge pull request #7584 from eugenp/remove-extra-module
lor6 Aug 16, 2019
1563751
Merge pull request #7583 from eugenp/lor6-patch-2
lor6 Aug 16, 2019
3897ea7
Merge pull request #7582 from eugenp/lor6-patch-3
lor6 Aug 16, 2019
a7a7e6c
[BAEL-2996] Using OptionsBuilder instead of main method for benchmarking
Aug 16, 2019
4f96691
Merge branch 'master' into bael-3090
Aug 16, 2019
a7c0f0b
BAEL-16783 Slice 2 | The top 100 articles should have their own packa…
dkapil Aug 16, 2019
f9cf8ee
Removed unnecessary main method. Changed assert methods to the one fo…
Alfred-Samanga Aug 17, 2019
376f6f9
[BAEL-16739] - Fixed the integrations tests in rest-assured
amit2103 Aug 17, 2019
e9d0959
[BAEL-16680] - Modified Spring Milestone/RC repos to GA
amit2103 Aug 17, 2019
4571126
Merge pull request #7599 from amit2103/BAEL-16680
lor6 Aug 17, 2019
e3b359d
Merge pull request #7597 from amit2103/BAEL-16739
lor6 Aug 17, 2019
cd95b41
Merge pull request #7589 from eugenp/lor6-patch-5
lor6 Aug 17, 2019
968db06
Merge pull request #7590 from eugenp/lor6-patch-6
lor6 Aug 17, 2019
e87bedc
Merge pull request #7591 from eugenp/lor6-patch-7
lor6 Aug 17, 2019
8b68e17
Update Movie.java
pallavi-priyadarshani Aug 17, 2019
d4b8f86
Update pom.xml
pallavi-priyadarshani Aug 17, 2019
6bd963d
Merge pull request #7592 from dupirefr/bael-2996-ter
Aug 18, 2019
20f4c8d
Merge pull request #7423 from dupirefr/bael-3090
Aug 18, 2019
8205672
Merge pull request #7453 from asturcon/BAEL-3003-spring-tracing
rpvilao Aug 18, 2019
0c27e46
Changed implementation of the method that manually count words in a s…
Alfred-Samanga Aug 18, 2019
8470319
Merge pull request #8 from eugenp/master
Maiklins Aug 18, 2019
db1b7f1
BAEL-3012 Spring Request Parameters with Thymeleaf - move to new module
Aug 18, 2019
2c7c520
create triangles with for loops - examples (#7573)
catalin-burcea Aug 19, 2019
92aa2bd
Adding Metrics AspectJ article code changes (#7387)
norbertoritzmann Aug 19, 2019
5985675
Merge pull request #7612 from Maiklins/BAEL-3012-move-thymeleaf-param…
lor6 Aug 19, 2019
5f538f6
[BAEL-2951] moved packages (#7605)
sjmillington Aug 20, 2019
dbfeec5
Merge pull request #7451 from tapankavasthi/tavasthi-bael-3116
eric-martin Aug 20, 2019
7befda7
Merge pull request #7399 from pallavi-priyadarshani/BAEL-3005
eric-martin Aug 20, 2019
5bc7d85
[BAEL-3066] (Reverted and Redone) Spring Security: Exploring JDBC Aut…
rozagerardo Aug 20, 2019
b5272de
BAEL-2846- Intro to the Java Debug Interface (#7606)
SmartyAnsh Aug 21, 2019
85a3272
merge upstream
JonCook Aug 22, 2019
73bde4e
Updated Rejex to catter for apostrophes in words like John's
Alfred-Samanga Aug 22, 2019
3058af8
Updated manual word count code to catter for apostrophes in words lik…
Alfred-Samanga Aug 22, 2019
07b01f6
Updated Unit tests
Alfred-Samanga Aug 22, 2019
39a2838
Merge pull request #7561 from JonCook/master
lor6 Aug 22, 2019
d3ba9f4
Bael 2989 (#7609)
sandy03934 Aug 23, 2019
721542f
BAEL-16781 Moving top articles to their respective packages (#7594)
dkapil Aug 23, 2019
ce02770
BAEL-2741: JHipster authentication with external service (#7588)
michael-pratt Aug 23, 2019
7bcfd6b
Merge pull request #7595 from dkapil/task/BAEL-16783
lor6 Aug 23, 2019
8e190c7
Adding source code for the tutorial tracked under BAEL-3203. (#7600)
kcacademic Aug 23, 2019
00c5ecc
BAEL-3126 BAEL-2463 add links to articles (#7640)
KevinGilmore Aug 24, 2019
4be26bb
Adding source code for article tracked under BAEL-3172. (#7540)
kcacademic Aug 24, 2019
4c6d95a
Merge pull request #7579 from Alfred-Samanga/master
rpvilao Aug 24, 2019
0ff976e
BAEL-16326 Week 34 | go through the integration test results and see …
dkapil Aug 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions algorithms-miscellaneous-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
- [Checking If a List Is Sorted in Java](https://www.baeldung.com/java-check-if-list-sorted)
- [Checking if a Java Graph has a Cycle](https://www.baeldung.com/java-graph-has-a-cycle)
- [A Guide to the Folding Technique in Java](https://www.baeldung.com/folding-hashing-technique)
- [Creating a Triangle with for Loops in Java](https://www.baeldung.com/java-print-triangle)
30 changes: 21 additions & 9 deletions algorithms-miscellaneous-3/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<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">
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>
<artifactId>algorithms-miscellaneous-3</artifactId>
<version>0.0.1-SNAPSHOT</version>
Expand All @@ -18,17 +18,28 @@
<version>${org.assertj.core.version}</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${commons-collections4.version}</version>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>${retrofit.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-jackson</artifactId>
<version>${retrofit.version}</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -61,5 +72,6 @@
<org.assertj.core.version>3.9.0</org.assertj.core.version>
<commons-collections4.version>4.3</commons-collections4.version>
<guava.version>28.0-jre</guava.version>
<retrofit.version>2.6.0</retrofit.version>
</properties>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.baeldung.algorithms.interpolationsearch;

public class InterpolationSearch {

public static int interpolationSearch(int[] data, int item) {

int highEnd = (data.length - 1);
int lowEnd = 0;

while (item >= data[lowEnd] && item <= data[highEnd] && lowEnd <= highEnd) {

int probe = lowEnd + (highEnd - lowEnd) * (item - data[lowEnd]) / (data[highEnd] - data[lowEnd]);

if (highEnd == lowEnd) {
if (data[lowEnd] == item) {
return lowEnd;
} else {
return -1;
}
}

if (data[probe] == item) {
return probe;
}

if (data[probe] < item) {
lowEnd = probe + 1;
} else {
highEnd = probe - 1;
}
}
return -1;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.baeldung.algorithms.kmeans;

import java.util.Map;
import java.util.Objects;

/**
* Encapsulates all coordinates for a particular cluster centroid.
*/
public class Centroid {

/**
* The centroid coordinates.
*/
private final Map<String, Double> coordinates;

public Centroid(Map<String, Double> coordinates) {
this.coordinates = coordinates;
}

public Map<String, Double> getCoordinates() {
return coordinates;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Centroid centroid = (Centroid) o;
return Objects.equals(getCoordinates(), centroid.getCoordinates());
}

@Override
public int hashCode() {
return Objects.hash(getCoordinates());
}

@Override
public String toString() {
return "Centroid " + coordinates;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.baeldung.algorithms.kmeans;

import java.util.Map;

/**
* Defines a contract to calculate distance between two feature vectors. The less the
* calculated distance, the more two items are similar to each other.
*/
public interface Distance {

/**
* Calculates the distance between two feature vectors.
*
* @param f1 The first set of features.
* @param f2 The second set of features.
* @return Calculated distance.
* @throws IllegalArgumentException If the given feature vectors are invalid.
*/
double calculate(Map<String, Double> f1, Map<String, Double> f2);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.baeldung.algorithms.kmeans;

import java.util.List;
import java.util.Map;

/**
* Encapsulates methods to calculates errors between centroid and the cluster members.
*/
public class Errors {

public static double sse(Map<Centroid, List<Record>> clustered, Distance distance) {
double sum = 0;
for (Map.Entry<Centroid, List<Record>> entry : clustered.entrySet()) {
Centroid centroid = entry.getKey();
for (Record record : entry.getValue()) {
double d = distance.calculate(centroid.getCoordinates(), record.getFeatures());
sum += Math.pow(d, 2);
}
}

return sum;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.baeldung.algorithms.kmeans;

import java.util.Map;

/**
* Calculates the distance between two items using the Euclidean formula.
*/
public class EuclideanDistance implements Distance {

@Override
public double calculate(Map<String, Double> f1, Map<String, Double> f2) {
if (f1 == null || f2 == null) {
throw new IllegalArgumentException("Feature vectors can't be null");
}

double sum = 0;
for (String key : f1.keySet()) {
Double v1 = f1.get(key);
Double v2 = f2.get(key);

if (v1 != null && v2 != null) sum += Math.pow(v1 - v2, 2);
}

return Math.sqrt(sum);
}
}
Loading