Last active
January 31, 2018 21:03
-
-
Save santteegt/39c31e1241b2e69e63b372856347e518 to your computer and use it in GitHub Desktop.
ConsultaPopularEcuador2018 using Java8 & lambda programming
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 com.sun.javafx.binding.StringFormatter; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Vector; | |
import java.util.stream.IntStream; | |
/** | |
* Created by santteegt on 31/01/2018. | |
*/ | |
public class ConsultaEcuador2018 { | |
public static void main(String []args) { | |
List<String> votes = new ArrayList<>(Arrays.asList("?", "?", "?", "?", "?", "?", "?")); | |
IntStream.range(1, votes.size()+1) | |
.mapToObj(n -> ((n > 1) && (votes.size()-1) % n == 0 ? | |
String.format("En la pregunta %d vota NO", n): | |
String.format("En la pregunta %d vota SI", n)) | |
).forEach(System.out::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment