Skip to content

Instantly share code, notes, and snippets.

View Deivur's full-sized avatar

Ivan Denysenko Deivur

  • Ukraine, Dnipropetrovsk
View GitHub Profile
@Deivur
Deivur / LabeledEnum.java
Created June 20, 2019 11:27 — forked from jedvardsson/LabeledEnum.java
How to implement a custom Hibernate enum type indexed on a label
public interface LabeledEnum {
String getLabel();
}
@Deivur
Deivur / Solution.java
Created February 13, 2016 09:58
Пример работы с классом Properties
public class Solution {
public static Map<String, String> properties = new HashMap<>();
public static Properties props = new Properties();
public static void main (String[] args) throws Exception
{
new Solution().fillInPropertiesMap();
System.out.println(properties);
new Solution().save(new FileOutputStream("e:/f.properties"));
}
@Deivur
Deivur / LongestWord.java
Created December 25, 2015 10:25
Наибольшее составное слово в массиве. (состоит только из слов, заданных в данном массиве)
import java.util.ArrayList;
import java.util.Comparator;
import java.util.TreeMap;
public class LongestWord {
public static void main(String[] args) {
/* Creation an array of words */
String words[] = { "five", "fivetwo", "fourfive", "fourfivetwo", "one", "onefiveone", "two", "twofivefourone" };
/* Output */
@Deivur
Deivur / Palindrome.java
Created December 25, 2015 10:22
Определение наименьшего числа-палиндрома, которое будет больше заданного.
public class Palindrome {
public static void main(String[] args) {
/* Initialization of variables, array; assigning input integer */
int naturalNumber = 203;
int palindrome = 0;
boolean palindromeFound = false;
char[] arr;
/* Increment the natural number is a palindrome not found */
while (!palindromeFound) {
@Deivur
Deivur / Xor.java
Created December 25, 2015 10:19
Поиск числа в массиве без пары. Генерация файла в YAML формате
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.ho.yaml.YamlEncoder;
public class Xor {
public static void main(String[] args) throws IOException {
/* Create array */