Clean the main method of the folding technique code snippet

This commit is contained in:
Andrew Shcherbakov 2019-06-15 11:31:19 +02:00
parent 573f3d75af
commit 41502a7507
2 changed files with 11 additions and 15 deletions

View File

@ -9,7 +9,7 @@ import java.util.stream.IntStream;
* The implementation serves only to the illustration purposes and is far * The implementation serves only to the illustration purposes and is far
* from being the most efficient. * from being the most efficient.
* *
* @author veontomo * @author A.Shcherbakov
* *
*/ */
public class FoldingHash { public class FoldingHash {

View File

@ -1,21 +1,17 @@
package com.baeldung.folding; package com.baeldung.folding;
import java.util.stream.IntStream; /**
* Code snippet for article "A Guide to the Folding Technique".
*
* @author A.Shcherbakov
*
*/
public class Main { public class Main {
public static void main(String... arg) { public static void main(String... arg) {
final String key = "Java language"; FoldingHash hasher = new FoldingHash();
final String str = "Java language";
toAsciiCodes(key).forEach(c -> System.out.println(c)); System.out.println(hasher.hash(str, 2, 100_000));
// toAsciiCodes(key).reduce(new ArrayList<Integer>(), (accum, i) -> i); System.out.println(hasher.hash(str, 3, 1_000));
// List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
// numbers.stream()
// .reduce(new ArrayList<Integer>(), (k, v) -> new ArrayList<Integer>());
// System.out.println(result);
}
public static IntStream toAsciiCodes(String key) {
return key.chars();
} }
} }