This commit is contained in:
Dhawal Kapil 2019-08-05 22:41:13 +05:30
commit 10163e417d
224 changed files with 1177 additions and 2099 deletions

View File

@ -1,4 +1,4 @@
## Relevant articles:
## Relevant Articles:
- [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique)
- [Implementing Simple State Machines with Java Enums](https://www.baeldung.com/java-enum-simple-state-machine)

View File

@ -0,0 +1,45 @@
package com.baeldung.metaprogramming
import groovy.transform.AutoClone
import groovy.transform.Canonical
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import groovy.transform.TupleConstructor
import groovy.util.logging.*
@Canonical
@TupleConstructor
@EqualsAndHashCode
@ToString(includePackage=false, excludes=['id'])
@Log
@AutoClone
class Employee {
long id
String firstName
String lastName
int age
//method to catch missing property's getter
def propertyMissing(String propertyName) {
log.info "$propertyName is not available"
"property '$propertyName' is not available"
}
//method to catch missing property's setter
def propertyMissing(String propertyName, propertyValue) {
println "property '$propertyName' is not available"
log.info "$propertyName is not available"
"property '$propertyName' is not available"
}
def methodMissing(String methodName, def methodArgs) {
log.info "$methodName is not defined"
"method '$methodName' is not defined"
}
def logEmp() {
log.info "Employee: $lastName, $firstName is of $age years age"
}
}

View File

@ -0,0 +1,30 @@
package com.baeldung.metaprogramming.extension
import com.baeldung.metaprogramming.Employee
class BasicExtensions {
static int getYearOfBirth(Employee self) {
return (new Date().getYear() + 1900) - self.age;
}
static String capitalize(String self) {
return self.substring(0, 1).toUpperCase() + self.substring(1)
}
static void printCounter(Integer self) {
while (self>0) {
println self
self--
}
}
static Long square(Long self) {
return self*self
}
static BigDecimal cube(BigDecimal self) {
return self*self*self
}
}

View File

@ -0,0 +1,10 @@
package com.baeldung.metaprogramming.extension
import com.baeldung.metaprogramming.Employee
class StaticEmployeeExtension {
static Employee getDefaultObj(Employee self) {
return new Employee(firstName: "firstName", lastName: "lastName", age: 20)
}
}

View File

@ -0,0 +1,4 @@
moduleName=core-groovy-2
moduleVersion=1.0-SNAPSHOT
extensionClasses=com.baeldung.metaprogramming.extension.BasicExtensions
staticExtensionClasses=com.baeldung.metaprogramming.extension.StaticEmployeeExtension

View File

@ -0,0 +1,118 @@
package com.baeldung.metaprogramming
import groovy.time.TimeCategory
class MetaprogrammingUnitTest extends GroovyTestCase {
Employee emp = new Employee(firstName: "Norman", lastName: "Lewis")
void testPropertyMissing() {
assert emp.address == "property 'address' is not available"
}
void testMethodMissing() {
Employee emp = new Employee()
try {
emp.getFullName()
} catch(MissingMethodException e) {
println "method is not defined"
}
assert emp.getFullName() == "method 'getFullName' is not defined"
}
void testMetaClassProperty() {
Employee.metaClass.address = ""
emp = new Employee(firstName: "Norman", lastName: "Lewis", address: "US")
assert emp.address == "US"
}
void testMetaClassMethod() {
emp.metaClass.getFullName = {
"$lastName, $firstName"
}
assert emp.getFullName() == "Lewis, Norman"
}
void testMetaClassConstructor() {
try {
Employee emp = new Employee("Norman")
} catch(GroovyRuntimeException e) {
assert e.message == "Could not find matching constructor for: com.baeldung.metaprogramming.Employee(String)"
}
Employee.metaClass.constructor = { String firstName ->
new Employee(firstName: firstName)
}
Employee norman = new Employee("Norman")
assert norman.firstName == "Norman"
assert norman.lastName == null
}
void testJavaMetaClass() {
String.metaClass.capitalize = { String str ->
str.substring(0, 1).toUpperCase() + str.substring(1);
}
assert "norman".capitalize() == "Norman"
}
void testEmployeeExtension() {
Employee emp = new Employee(age: 28)
assert emp.getYearOfBirth() == 1991
}
void testJavaClassesExtensions() {
5.printCounter()
assert 40l.square() == 1600l
assert (2.98).cube() == 26.463592
}
void testStaticEmployeeExtension() {
assert Employee.getDefaultObj().firstName == "firstName"
assert Employee.getDefaultObj().lastName == "lastName"
assert Employee.getDefaultObj().age == 20
}
void testToStringAnnotation() {
Employee employee = new Employee()
employee.id = 1
employee.firstName = "norman"
employee.lastName = "lewis"
employee.age = 28
assert employee.toString() == "Employee(norman, lewis, 28)"
}
void testTupleConstructorAnnotation() {
Employee norman = new Employee(1, "norman", "lewis", 28)
assert norman.toString() == "Employee(norman, lewis, 28)"
Employee snape = new Employee(2, "snape")
assert snape.toString() == "Employee(snape, null, 0)"
}
void testEqualsAndHashCodeAnnotation() {
Employee norman = new Employee(1, "norman", "lewis", 28)
Employee normanCopy = new Employee(1, "norman", "lewis", 28)
assert norman.equals(normanCopy)
assert norman.hashCode() == normanCopy.hashCode()
}
void testAutoCloneAnnotation() {
try {
Employee norman = new Employee(1, "norman", "lewis", 28)
def normanCopy = norman.clone()
assert norman == normanCopy
} catch(CloneNotSupportedException e) {
e.printStackTrace()
}
}
void testLoggingAnnotation() {
Employee employee = new Employee(1, "Norman", "Lewis", 28)
employee.logEmp()
}
}

View File

@ -7,3 +7,4 @@
- [How to Delay Code Execution in Java](https://www.baeldung.com/java-delay-code-execution)
- [Run JAR Application With Command Line Arguments](https://www.baeldung.com/java-run-jar-with-arguments)
- [Java 8 Stream skip() vs limit()](https://www.baeldung.com/java-stream-skip-vs-limit)
- [Guide to Java BiFunction Interface](https://www.baeldung.com/java-bifunction-interface)

View File

@ -7,7 +7,7 @@
- [Check if a Java Array Contains a Value](http://www.baeldung.com/java-array-contains-value)
- [Initializing Arrays in Java](http://www.baeldung.com/java-initialize-array)
- [Guide to the java.util.Arrays Class](http://www.baeldung.com/java-util-arrays)
- [Jagged Arrays In Java](http://www.baeldung.com/java-jagged-arrays)
- [Multi-Dimensional Arrays In Java](http://www.baeldung.com/java-jagged-arrays)
- [Find Sum and Average in a Java Array](http://www.baeldung.com/java-array-sum-average)
- [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide)
- [How to Invert an Array in Java](http://www.baeldung.com/java-invert-array)
@ -16,3 +16,4 @@
- [Sorting Arrays in Java](https://www.baeldung.com/java-sorting-arrays)
- [Convert a Float to a Byte Array in Java](https://www.baeldung.com/java-convert-float-to-byte-array)
- [Converting Between Stream and Array in Java](https://www.baeldung.com/java-stream-to-array)
- [Removing an Element from an Array in Java](https://www.baeldung.com/java-array-remove-element)

View File

@ -0,0 +1,3 @@
### Relevant Articles
- [Design Strategies for Decoupling Java Modules](https://www.baeldung.com/java-modules-decoupling-design-strategies)

View File

@ -0,0 +1,43 @@
<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.baeldung</groupId>
<artifactId>core-java-lang-operators</artifactId>
<version>0.1.0-SNAPSHOT</version>
<name>core-java-lang-operators</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
</parent>
<dependencies>
<!-- test scoped -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>core-java-lang-operators</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<!-- testing -->
<assertj-core.version>3.10.0</assertj-core.version>
</properties>
</project>

View File

@ -0,0 +1,64 @@
package com.baeldung.incrementdecrementunaryoperators;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
public class IncrementDecrementUnaryOperatorUnitTest {
@Test
public void givenAnOperand_whenUsingPreIncrementUnaryOperator_thenOperandIsIncrementedByOne() {
int operand = 1;
++operand;
assertThat(operand).isEqualTo(2);
}
@Test
public void givenANumber_whenUsingPreIncrementUnaryOperatorInEvaluation_thenNumberIsIncrementedByOne() {
int operand = 1;
int number = ++operand;
assertThat(number).isEqualTo(2);
}
@Test
public void givenAnOperand_whenUsingPreDecrementUnaryOperator_thenOperandIsDecrementedByOne() {
int operand = 1;
--operand;
assertThat(operand).isEqualTo(0);
}
@Test
public void givenANumber_whenUsingPreDecrementUnaryOperatorInEvaluation_thenNumberIsDecrementedByOne() {
int operand = 1;
int number = --operand;
assertThat(number).isEqualTo(0);
}
@Test
public void givenAnOperand_whenUsingPostIncrementUnaryOperator_thenOperandIsIncrementedByOne() {
int operand = 1;
operand++;
assertThat(operand).isEqualTo(2);
}
@Test
public void givenANumber_whenUsingPostIncrementUnaryOperatorInEvaluation_thenNumberIsSameAsOldValue() {
int operand = 1;
int number = operand++;
assertThat(number).isEqualTo(1);
}
@Test
public void givenAnOperand_whenUsingPostDecrementUnaryOperator_thenOperandIsDecrementedByOne() {
int operand = 1;
operand--;
assertThat(operand).isEqualTo(0);
}
@Test
public void givenANumber_whenUsingPostDecrementUnaryOperatorInEvaluation_thenNumberIsSameAsOldValue() {
int operand = 1;
int number = operand--;
assertThat(number).isEqualTo(1);
}
}

View File

@ -18,3 +18,4 @@
- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java)
- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator)
- [Java instanceof Operator](https://www.baeldung.com/java-instanceof)
- [Breaking Out of Nested Loops](https://www.baeldung.com/java-breaking-out-nested-loop)

View File

@ -1,25 +0,0 @@
*.class
0.*
#folders#
/target
/neoDb*
/data
/src/main/webapp/WEB-INF/classes
*/META-INF/*
.resourceCache
# Packaged files #
*.jar
*.war
*.ear
# Files generated by integration tests
backup-pom.xml
/bin/
/temp
#IntelliJ specific
.idea/
*.iml

View File

@ -1,3 +1,3 @@
## Relevant articles:
## Relevant Articles:
- [Determine File Creating Date in Java](https://www.baeldung.com/java-file-creation-date)
- [Determine File Creation Date in Java](https://www.baeldung.com/java-file-creation-date)

View File

@ -10,3 +10,4 @@
- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures)
- [SHA-256 and SHA3-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java)
- [Enabling TLS v1.2 in Java 7](https://www.baeldung.com/java-7-tls-v12)
- [The Java SecureRandom Class](https://www.baeldung.com/java-secure-random)

View File

@ -17,6 +17,7 @@
<module>pre-jpms</module>
<module>core-java-exceptions</module>
<module>core-java-optional</module>
<module>core-java-lang-operators</module>
<module>core-java-networking-2</module>
</modules>

View File

@ -1,4 +1,5 @@
## Relevant articles:
[The Trie Data Structure in Java](https://www.baeldung.com/trie-java)
[Implementing a Binary Tree in Java](https://www.baeldung.com/java-binary-tree)
- [The Trie Data Structure in Java](https://www.baeldung.com/trie-java)
- [Implementing a Binary Tree in Java](https://www.baeldung.com/java-binary-tree)
- [Depth First Search in Java](https://www.baeldung.com/java-depth-first-search)

View File

@ -2,6 +2,7 @@ package com.baeldung.graph;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Stack;
@ -29,7 +30,7 @@ public class Graph {
while (!stack.isEmpty()) {
int current = stack.pop();
isVisited[current] = true;
System.out.print(" " + current);
visit(current);
for (int dest : adjVertices.get(current)) {
if (!isVisited[dest])
stack.push(dest);
@ -44,29 +45,30 @@ public class Graph {
private void dfsRecursive(int current, boolean[] isVisited) {
isVisited[current] = true;
System.out.print(" " + current);
visit(current);
for (int dest : adjVertices.get(current)) {
if (!isVisited[dest])
dfsRecursive(dest, isVisited);
}
}
public void topologicalSort(int start) {
Stack<Integer> result = new Stack<Integer>();
public List<Integer> topologicalSort(int start) {
LinkedList<Integer> result = new LinkedList<Integer>();
boolean[] isVisited = new boolean[adjVertices.size()];
topologicalSortRecursive(start, isVisited, result);
while (!result.isEmpty()) {
System.out.print(" " + result.pop());
}
return result;
}
private void topologicalSortRecursive(int current, boolean[] isVisited, Stack<Integer> result) {
private void topologicalSortRecursive(int current, boolean[] isVisited, LinkedList<Integer> result) {
isVisited[current] = true;
for (int dest : adjVertices.get(current)) {
if (!isVisited[dest])
topologicalSortRecursive(dest, isVisited, result);
}
result.push(current);
result.addFirst(current);
}
private void visit(int value) {
System.out.print(" " + value);
}
}

View File

@ -103,14 +103,14 @@ public class BinaryTree {
public void traverseInOrder(Node node) {
if (node != null) {
traverseInOrder(node.left);
System.out.print(" " + node.value);
visit(node.value);
traverseInOrder(node.right);
}
}
public void traversePreOrder(Node node) {
if (node != null) {
System.out.print(" " + node.value);
visit(node.value);
traversePreOrder(node.left);
traversePreOrder(node.right);
}
@ -120,7 +120,7 @@ public class BinaryTree {
if (node != null) {
traversePostOrder(node.left);
traversePostOrder(node.right);
System.out.print(" " + node.value);
visit(node.value);
}
}
@ -159,7 +159,7 @@ public class BinaryTree {
stack.push(current);
}
current = stack.pop();
System.out.print(" " + current.value);
visit(current.value);
if(current.right != null) {
current = current.right;
stack.push(current);
@ -173,7 +173,7 @@ public class BinaryTree {
stack.push(root);
while(! stack.isEmpty()) {
current = stack.pop();
System.out.print(" " + current.value);
visit(current.value);
if(current.right != null)
stack.push(current.right);
@ -196,7 +196,7 @@ public class BinaryTree {
if (!hasChild || isPrevLastChild) {
current = stack.pop();
System.out.print(" " + current.value);
visit(current.value);
prev = current;
} else {
if (current.right != null) {
@ -209,6 +209,9 @@ public class BinaryTree {
}
}
private void visit(int value) {
System.out.print(" " + value);
}
class Node {
int value;

View File

@ -1,5 +1,7 @@
package com.baeldung.graph;
import java.util.List;
import org.junit.Test;
public class GraphUnitTest {
@ -15,7 +17,8 @@ public class GraphUnitTest {
@Test
public void givenDirectedGraph_whenGetTopologicalSort_thenPrintValuesSorted() {
Graph graph = createDirectedGraph();
graph.topologicalSort(0);
List<Integer> list = graph.topologicalSort(0);
System.out.println(list);
}
private Graph createDirectedGraph() {

View File

@ -2,7 +2,7 @@
## Jackson Cookbooks and Examples
###The Course
### The Course
The "REST With Spring" Classes: http://bit.ly/restwithspring
### Relevant Articles:
@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [How to Process YAML with Jackson](https://www.baeldung.com/jackson-yaml)
- [Working with Tree Model Nodes in Jackson](https://www.baeldung.com/jackson-json-node-tree-model)
- [Converting JSON to CSV in Java](https://www.baeldung.com/java-converting-json-to-csv)
- [Compare Two JSON Objects with Jackson](https://www.baeldung.com/jackson-compare-two-json-objects)

View File

@ -1,3 +1,4 @@
## Relevant Articles:
- [Converting Between LocalDate and XMLGregorianCalendar](https://www.baeldung.com/java-localdate-to-xmlgregoriancalendar)
- [Convert Time to Milliseconds in Java](https://www.baeldung.com/java-time-milliseconds)
- [Check If a String Is a Valid Date in Java](https://www.baeldung.com/java-string-valid-date)

View File

@ -29,3 +29,4 @@
- [A Guide to SimpleDateFormat](https://www.baeldung.com/java-simple-date-format)
- [ZoneOffset in Java](https://www.baeldung.com/java-zone-offset)
- [Differences Between ZonedDateTime and OffsetDateTime](https://www.baeldung.com/java-zoneddatetime-offsetdatetime)
- [Introduction to Joda-Time](http://www.baeldung.com/joda-time)

View File

@ -1,26 +0,0 @@
*.class
0.*
#folders#
/target
/neoDb*
/data
/src/main/webapp/WEB-INF/classes
*/META-INF/*
.resourceCache
# Packaged files #
*.jar
*.war
*.ear
# Files generated by integration tests
*.txt
backup-pom.xml
/bin/
/temp
#IntelliJ specific
.idea/
*.iml

View File

@ -1,7 +0,0 @@
## Relevant Articles
- [Java Localization Formatting Messages](https://www.baeldung.com/java-localization-messages-formatting)
- [Check If a String Contains a Substring](https://www.baeldung.com/java-string-contains-substring)
- [Removing Stopwords from a String in Java](https://www.baeldung.com/java-string-remove-stopwords)
- [Blank and Empty Strings in Java](https://www.baeldung.com/java-blank-empty-strings)
- [String Initialization in Java](https://www.baeldung.com/java-string-initialization)

25
java-strings-2/README.md Normal file
View File

@ -0,0 +1,25 @@
## Relevant Articles:
- [Java Localization Formatting Messages](https://www.baeldung.com/java-localization-messages-formatting)
- [Check If a String Contains a Substring](https://www.baeldung.com/java-string-contains-substring)
- [Removing Stopwords from a String in Java](https://www.baeldung.com/java-string-remove-stopwords)
- [Java Generate Random String](http://www.baeldung.com/java-random-string)
- [Image to Base64 String Conversion](http://www.baeldung.com/java-base64-image-string)
- [Java Base64 Encoding and Decoding](https://www.baeldung.com/java-base64-encode-and-decode)
- [Generate a Secure Random Password in Java](https://www.baeldung.com/java-generate-secure-password)
- [Removing Repeated Characters from a String](https://www.baeldung.com/java-remove-repeated-char)
- [Join Array of Primitives with Separator in Java](https://www.baeldung.com/java-join-primitive-array)
- [Pad a String with Zeros or Spaces in Java](https://www.baeldung.com/java-pad-string)
- [Remove Emojis from a Java String](https://www.baeldung.com/java-string-remove-emojis)
- [Convert a Comma Separated String to a List in Java](https://www.baeldung.com/java-string-with-separator-to-list)
- [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter)
- [Remove Leading and Trailing Characters from a String](https://www.baeldung.com/java-remove-trailing-characters)
- [Concatenating Strings In Java](https://www.baeldung.com/java-strings-concatenation)
- [Java String Interview Questions and Answers](https://www.baeldung.com/java-string-interview-questions)
- [Check if a String is a Pangram in Java](https://www.baeldung.com/java-string-pangram)
- [Check If a String Contains Multiple Keywords](https://www.baeldung.com/string-contains-multiple-words)
- [Checking for Empty or Blank Strings in Java](https://www.baeldung.com/java-blank-empty-strings)
- [String Initialization in Java](https://www.baeldung.com/java-string-initialization)
- [Java Multi-line String](https://www.baeldung.com/java-multiline-string)
- [Checking If a String Is a Repeated Substring](https://www.baeldung.com/java-repeated-substring)
- [How to Reverse a String in Java](https://www.baeldung.com/java-reverse-string)

View File

@ -40,6 +40,16 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -52,32 +62,54 @@
<version>${org.hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<!-- Added for password generation -->
<dependency>
<groupId>org.passay</groupId>
<artifactId>passay</artifactId>
<version>${passay.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>${commons-text.version}</version>
</dependency>
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>emoji-java</artifactId>
<version>${emoji-java.version}</version>
</dependency>
<dependency>
<groupId>org.ahocorasick</groupId>
<artifactId>ahocorasick</artifactId>
<version>${ahocorasick.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
<version>${validation-api.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.2.Final</version>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<version>${javax.el-api.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.6</version>
<version>${javax.el.version}</version>
</dependency>
</dependencies>
<build>
@ -105,9 +137,19 @@
<properties>
<commons-lang3.version>3.8.1</commons-lang3.version>
<commons-codec.version>1.10</commons-codec.version>
<passay.version>1.3.1</passay.version>
<!-- testing -->
<assertj.version>3.6.1</assertj.version>
<emoji-java.version>4.0.0</emoji-java.version>
<ahocorasick.version>0.4.0</ahocorasick.version>
<icu4j.version>61.1</icu4j.version>
<guava.version>28.0-jre</guava.version>
<commons-text.version>1.4</commons-text.version>
<validation-api.version>2.0.0.Final</validation-api.version>
<hibernate-validator.version>6.0.2.Final</hibernate-validator.version>
<javax.el-api.version>3.0.0</javax.el-api.version>
<javax.el.version>2.2.6</javax.el.version>
</properties>
</project>

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,22 @@
=========
## Java Strings Cookbooks and Examples
### Relevant Articles:
- [Convert char to String in Java](http://www.baeldung.com/java-convert-char-to-string)
- [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer)
- [Java String Conversions](https://www.baeldung.com/java-string-conversions)
- [Check if a String is a Palindrome](http://www.baeldung.com/java-palindrome)
- [Comparing Strings in Java](http://www.baeldung.com/java-compare-strings)
- [Check If a String Is Numeric in Java](http://www.baeldung.com/java-check-string-number)
- [Get Substring from String in Java](https://www.baeldung.com/java-substring)
- [How to Remove the Last Character of a String?](http://www.baeldung.com/java-remove-last-character-of-string)
- [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string)
- [Count Occurrences of a Char in a String](http://www.baeldung.com/java-count-chars)
- [Guide to Java String Pool](http://www.baeldung.com/java-string-pool)
- [Split a String in Java](http://www.baeldung.com/java-split-string)
- [Common String Operations in Java](https://www.baeldung.com/java-string-operations)
- [Convert String to Byte Array and Reverse in Java](https://www.baeldung.com/java-string-to-byte-array)
- [Java toString() Method](https://www.baeldung.com/java-tostring)
- [CharSequence vs. String in Java](http://www.baeldung.com/java-char-sequence-string)
- [StringBuilder and StringBuffer in Java](http://www.baeldung.com/java-string-builder-string-buffer)

99
java-strings-ops/pom.xml Normal file
View File

@ -0,0 +1,99 @@
<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.baeldung</groupId>
<artifactId>java-strings-ops</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>java-strings-ops</name>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- test scoped -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh-core.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh-generator.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter-api.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${org.hamcrest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>java-strings-ops</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<!-- util -->
<commons-lang3.version>3.8.1</commons-lang3.version>
<!-- testing -->
<assertj.version>3.6.1</assertj.version>
<guava.version>27.0.1-jre</guava.version>
<junit-jupiter-api.version>5.3.1</junit-jupiter-api.version>
</properties>
</project>

Some files were not shown because too many files have changed in this diff Show More