This file contains 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.io.BufferedReader; | |
import java.io.Reader; | |
import java.util.Map; | |
import java.util.function.Function; | |
import java.util.regex.Pattern; | |
import static java.util.stream.Collectors.counting; | |
import static java.util.stream.Collectors.groupingBy; | |
public class WordsFrequencies { |
This file contains 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
public class EquationStream { | |
public static void main(String[] args) { | |
List<Month> months = new ArrayList<>(12); | |
months.add(new Month(1, "January")); | |
months.add(new Month(2, "February")); | |
months.add(new Month(3, "March")); | |
months.add(new Month(4, "April")); | |
months.add(new Month(5, "May")); |
This file contains 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
public boolean add(E e) { | |
return this.m.put(e, PRESENT) == null; | |
} |
This file contains 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 int compareItems(TestItem item1, TestItem item2) { | |
return item2.name.compareToIgnoreCase(item1.name); | |
} |
This file contains 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.*; | |
public class TreeSetWithDuplicates { | |
public static void main(String[] args) { | |
System.out.println(removeDuplicates(Arrays.asList( | |
new TestItem("Book A", "First edition"), | |
new TestItem("Book C", "First edition"), | |
new TestItem("Book ABC", "Not published"), | |
new TestItem("Book A", "First edition")))); | |
} |
This file contains 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
@RunWith(SpringJUnit4ClassRunner.class) | |
@SpringApplicationConfiguration(classes = {HibernateJpaAutoConfiguration.class, | |
DatabasesConfig.class, JpaRepositoriesConfig.class}) | |
public class YourDbTest { | |
// test methods | |
} |
This file contains 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.Map; | |
import javax.sql.DataSource; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilder; | |
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.ComponentScan.Filter; |
This file contains 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 javax.sql.DataSource; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; |
This file contains 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
appName.dbOne.datasource.driverClassName=org.postgresql.Driver | |
appName.dbOne.datasource.url=jdbc:postgresql://localhost/dbOne | |
appName.dbOne.datasource.username=test | |
appName.dbOne.datasource.password=test | |
appName.dbTwo.datasource.driverClassName=org.postgresql.Driver | |
appName.dbTwo.datasource.url=jdbc:postgresql://localhost/dbTwo | |
appName.dbTwo.datasource.username=test | |
appName.dbTwo.datasource.password=test |
This file contains 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
#!/bin/sh | |
systemctl enable testrest.service |
NewerOlder