Skip to content

Instantly share code, notes, and snippets.

View mzimecki's full-sized avatar

Marcin Zimecki mzimecki

  • Gdańsk, Poland
View GitHub Profile
@mzimecki
mzimecki / EnumSetTest.java
Last active December 19, 2015 22:39
[Java] EnumSet order
import java.util.EnumSet;
/**
* EnumSet uses natural order which means the order in which the enum constants are declared.
*/
public class EnumSetTest {
private enum MyEnum {A, B, C, D}
public static void main(String [] args) {
@mzimecki
mzimecki / FunctionsCall.scala
Last active December 19, 2015 19:48
[Scala] Many ways of passing x < 0 function into exists function (verbose version as first one). Each of them has the same meaning.
def containsNeg1(nums: List[Int]) = nums.exists((x: Int) => x < 0)
def containsNeg2(nums: List[Int]) = nums.exists((x) => x < 0)
def containsNeg3(nums: List[Int]) = nums.exists(x => x < 0)
def containsNeg4(nums: List[Int]) = nums.exists(_ < 0)