<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>package.to.Main.Class</mainClass>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kind: Service | |
| apiVersion: v1 | |
| metadata: | |
| name: hostname-service | |
| spec: | |
| # Expose the service on a static port on each node | |
| # so that we can access the service from outside the cluster | |
| type: NodePort | |
| # When the node receives a request on the static port (30163) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static String getStartingPlaceOfTheJourney(List<List<String>> journeysList) { | |
| final int STARTING_POSITION = 0; | |
| final int ENDING_POSITION = 1; | |
| for (int index = 0; index < journeysList.size(); ++index) { | |
| final int nextDistanceIndex = index + ENDING_POSITION; | |
| if (nextDistanceIndex < journeysList.size()) { | |
| final String startingPoint = journeysList.get(index) | |
| .get(STARTING_POSITION); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <plugin> | |
| <artifactId>maven-dependency-plugin</artifactId> | |
| <version>3.1.1</version> | |
| <executions> | |
| <execution> | |
| <id>analyze</id> | |
| <goals> | |
| <goal>analyze-only</goal> | |
| </goals> | |
| <configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final long calendarWeek = 44; | |
| final LocalDate startDate = LocalDate.now() | |
| .with(IsoFields.WEEK_OF_WEEK_BASED_YEAR, calendarWeek) | |
| .with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); | |
| final LocalDate endDate = startDate.plusDays(6); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| File dir = new File("<DirectoryPath>"); | |
| String[] extensions = new String[] { "json", "java" }; | |
| System.out.println("Getting all .json and .java files in " + dir.getCanonicalPath() | |
| + " including those in subdirectories"); | |
| List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true); | |
| for (File file : files) { | |
| System.out.println("file: " + file.getCanonicalPath()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String sentence = "The sly brown Fox jumped over the lazy foX."; | |
| String result = sentence.replaceAll("(?i)fox", "dog"); | |
| System.out.println("Input: " + sentence); | |
| System.out.println("Output: " + result); | |
| //Input: The sly brown Fox jumped over the lazy foX. | |
| //Output: The sly brown dog jumped over the lazy dog. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package utility; | |
| import java.util.AbstractList; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.Collection; | |
| import java.util.List; | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| import java.util.stream.Collectors; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import static org.hamcrest.CoreMatchers.*; | |
| import static org.junit.Assert.*; | |
| import org.junit.*; | |
| import org.junit.rules.ExpectedException; | |
| import org.junit.runner.RunWith; | |
| import junitparams.JUnitParamsRunner; | |
| import junitparams.Parameters; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| class CustomString { | |
| private static String concatenate(String... inputs) { | |
| var stringSize = Arrays.stream(inputs).mapToInt(input -> input.toCharArray().length).sum(); | |
| var newInputCharArray = new char[stringSize]; | |
| int index = 0; |