Java Code Examples for com.google.common.math.IntMath#factorial()

The following examples show how to use com.google.common.math.IntMath#factorial() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Collections2.java    From codebuff with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public int size() {
  return IntMath.factorial(inputList.size());
}
 
Example 2
Source File: Collections2.java    From codebuff with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public int size() {
  return IntMath.factorial(inputList.size());
}
 
Example 3
Source File: Collections2.java    From codebuff with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public int size() {
  return IntMath.factorial(inputList.size());
}
 
Example 4
Source File: Collections2.java    From codebuff with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public int size() {
  return IntMath.factorial(inputList.size());
}
 
Example 5
Source File: Collections2.java    From codebuff with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public int size() {
  return IntMath.factorial(inputList.size());
}
 
Example 6
Source File: GuavaMathUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
public void should_calculate_factorial() {
    int result = IntMath.factorial(4);
    assertThat(result, equalTo(24));
}
 
Example 7
Source File: GuavaIntMathUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
public void whenFactorailInteger_shouldFactorialThemAndReturnTheResultIfInIntRange() {
    int result = IntMath.factorial(5);
    assertEquals(120, result);
}
 
Example 8
Source File: GuavaIntMathUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Test
public void whenFactorailInteger_shouldFactorialThemAndReturnIntMaxIfNotInIntRange() {
    int result = IntMath.factorial(Integer.MAX_VALUE);
    assertEquals(Integer.MAX_VALUE, result);
}