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
// https://github.com/bati11/learn-scala/tree/master/getting_started/day1 | |
// おさらい | |
// List(1,2,3)とList(10,100,1000)の各要素を掛け合わせた結果からなるコレクションをつくるfor式を書いてください | |
for (x <- 1 to 3; y <- 1 to 3) yield x * Math.pow(10, y.toInt) | |
//掛け合わせた結果が50以上になるコレクションをつくるfor式を書いてください。 | |
(for (x <- 1 to 3; y <- 1 to 3) yield x * Math.pow(10, y.toInt).toInt).filter(x => x >= 50) | |
//100までの偶数の中で、7で割った余りが3になる数値からなるコレクションをつくってください。 |
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.stream.Collectors; | |
import java.util.stream.IntStream; | |
import java.util.stream.Stream; | |
public class SemicolonLessFizzBuzz { | |
public static void main(String[] args) { | |
System.out.println("### 1 ###\n"); | |
case1(); |