Skip to main content
adicionou 4 caracteres ao conteúdo
Fonte Link
package test;

import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

    @FunctionalInterface
    public interface FactorialFunc<T> {
        T factorial (T t);
    }

    @Test
    public void testFactorial() {
        int value = 5;
        FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5value).reduce((i,j) -> i * j).getAsInt();
        Assert.assertEquals(120, f.factorial(value));
    }
}
package test;

import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

    @FunctionalInterface
    public interface FactorialFunc<T> {
        T factorial (T t);
    }

    @Test
    public void testFactorial() {
        int value = 5;
        FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5).reduce((i,j) -> i * j).getAsInt();
        Assert.assertEquals(120, f.factorial(value));
    }
}
package test;

import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

    @FunctionalInterface
    public interface FactorialFunc<T> {
        T factorial (T t);
    }

    @Test
    public void testFactorial() {
        int value = 5;
        FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, value).reduce((i,j) -> i * j).getAsInt();
        Assert.assertEquals(120, f.factorial(value));
    }
}
adicionou 84 caracteres ao conteúdo
Fonte Link

package test;

import org.testng.Assert; import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

package test;

import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

    @FunctionalInterface
    public interface FactorialFunc<T> {
        T factorial (T t);
    }

    @Test
    public void testFactorial() {
        int value = 5;
        FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5).reduce((i,j) -> i * j).getAsInt();
        Assert.assertEquals(120, f.factorial(value));
    }
}

}

package test;

import org.testng.Assert; import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

@FunctionalInterface
public interface FactorialFunc<T> {
    T factorial (T t);
}

@Test
public void testFactorial() {
    int value = 5;
    FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5).reduce((i,j) -> i * j).getAsInt();
    Assert.assertEquals(120, f.factorial(value));
}

}

package test;

import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

    @FunctionalInterface
    public interface FactorialFunc<T> {
        T factorial (T t);
    }

    @Test
    public void testFactorial() {
        int value = 5;
        FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5).reduce((i,j) -> i * j).getAsInt();
        Assert.assertEquals(120, f.factorial(value));
    }
}
adicionou 17 caracteres ao conteúdo
Fonte Link

package test;

import org.testng.Assert; import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

@FunctionalInterface
public interface FactorialFunc<T> {
    T factorial (T t);
}

@Test
public void testFactorial() {
    int value = 5;
    FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5).reduce((i,j) -> i * j).getAsInt();
    Assert.assertEquals(120, f.factorial(value));
}

}

import org.testng.Assert; import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

@FunctionalInterface
public interface FactorialFunc<T> {
    T factorial (T t);
}

@Test
public void testFactorial() {
    int value = 5;
    FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5).reduce((i,j) -> i * j).getAsInt();
    Assert.assertEquals(120, f.factorial(value));
}

}

package test;

import org.testng.Assert; import org.testng.annotations.Test;

import java.util.stream.IntStream;

public class FunctionalFactorial {

@FunctionalInterface
public interface FactorialFunc<T> {
    T factorial (T t);
}

@Test
public void testFactorial() {
    int value = 5;
    FactorialFunc<Integer>  f = (x) -> IntStream.rangeClosed(1, 5).reduce((i,j) -> i * j).getAsInt();
    Assert.assertEquals(120, f.factorial(value));
}

}

Fonte Link
Carregando