import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
import java.text.MessageFormat;
import com.google.common.collect.FluentIterable;
import java.util.Arrays;
import java.util.List;
import java.util.Iterator;
/**
* Use this class to change the password stored in the databae from one that is
* visible as plain text (a security threat) to one that is "hashed". Hashing is
* a one-way encryption system. Hashes can be generated but cannot be reverse
* engineered, which is why they are called one-way hashes. Use this class to
* generate a hashed password, based on the original plain text version, using
* SHA-256, which is a superior hashing algorithm. Then copy the output from the
* console and use it to replace what you have in your database.
*
* @author jlombardo
*/
public class Main {
public static void main
(String[] args
) { List
<String
> strings
= Arrays.
asList("hello",
"world",
"apple",
"banana",
"cat");
Iterator testIterator
= FluentIterable.
from(strings
) .transformAndConcat(word -> {
if (word.contains("a")) {
} else {
}
}).iterator();
while( testIterator.hasNext()) {
System.
out.
println("List length " + testIterator.
next()); }
}
}
aW1wb3J0IGNvbS5nb29nbGUuY29tbW9uLmJhc2UuQ2hhcnNldHM7CmltcG9ydCBjb20uZ29vZ2xlLmNvbW1vbi5oYXNoLkhhc2hpbmc7CmltcG9ydCBqYXZhLnRleHQuTWVzc2FnZUZvcm1hdDsKaW1wb3J0IGNvbS5nb29nbGUuY29tbW9uLmNvbGxlY3QuRmx1ZW50SXRlcmFibGU7CgppbXBvcnQgamF2YS51dGlsLkFycmF5czsKaW1wb3J0IGphdmEudXRpbC5MaXN0OwppbXBvcnQgamF2YS51dGlsLkl0ZXJhdG9yOwovKioKICogVXNlIHRoaXMgY2xhc3MgdG8gY2hhbmdlIHRoZSBwYXNzd29yZCBzdG9yZWQgaW4gdGhlIGRhdGFiYWUgZnJvbSBvbmUgdGhhdCBpcwogKiB2aXNpYmxlIGFzIHBsYWluIHRleHQgKGEgc2VjdXJpdHkgdGhyZWF0KSB0byBvbmUgdGhhdCBpcyAiaGFzaGVkIi4gSGFzaGluZyBpcwogKiBhIG9uZS13YXkgZW5jcnlwdGlvbiBzeXN0ZW0uIEhhc2hlcyBjYW4gYmUgZ2VuZXJhdGVkIGJ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IoKTsKICAgICAgICAKICAgICAgICB3aGlsZSggdGVzdEl0ZXJhdG9yLmhhc05leHQoKSkgewogICAgICAgIAlTeXN0ZW0ub3V0LnByaW50bG4oIkxpc3QgbGVuZ3RoICIgKyB0ZXN0SXRlcmF0b3IubmV4dCgpKTsKICAgICAgICB9CiAgICB9Cn0=