scala

# Int

#### final class Int extends AnyVal

`Int` is a member of the value classes, those whose instances are not represented as objects by the underlying host system.

There is an implicit conversion from Int => RichInt which provides useful non-primitive operations.

Source
  Int.scala

Linear Supertypes
AnyVal, Any
Ordering

1. Alphabetic
2. By inheritance

Inherited

1. Hide All
2. Show all

1. Int
2. AnyVal
3. Any

Visibility

1. Public
2. All

### Value Members

1. #### def !=(x: Double): Boolean

2. #### def !=(x: Float): Boolean

3. #### def !=(x: Long): Boolean

4. #### def !=(x: Int): Boolean

5. #### def !=(x: Char): Boolean

6. #### def !=(x: Short): Boolean

7. #### def !=(x: Byte): Boolean

8. #### final def !=(arg0: Any): Boolean

   Test two objects for inequality.

   Test two objects for inequality.

   returns

     `true` if !(this == that), false otherwise.

   Definition Classes
     Any

9. #### final def ##(): Int

   Equivalent to `x.hashCode` except for boxed numeric types.

   Equivalent to `x.hashCode` except for boxed numeric types. For numerics, it returns a hash value which is consistent with value equality: if two value type instances compare as true, then ## will produce the same hash value for each of them.

   returns

     a hash value consistent with ==

   Definition Classes
     Any

10. #### def %(x: Double): Double

11. #### def %(x: Float): Float

12. #### def %(x: Long): Long

13. #### def %(x: Int): Int

14. #### def %(x: Char): Int

15. #### def %(x: Short): Int

16. #### def %(x: Byte): Int

17. #### def &(x: Long): Long

18. #### def &(x: Int): Int

19. #### def &(x: Char): Int

20. #### def &(x: Short): Int

21. #### def &(x: Byte): Int

22. #### def *(x: Double): Double

23. #### def *(x: Float): Float

24. #### def *(x: Long): Long

25. #### def *(x: Int): Int

26. #### def *(x: Char): Int

27. #### def *(x: Short): Int

28. #### def *(x: Byte): Int

29. #### def +(x: Double): Double

30. #### def +(x: Float): Float

31. #### def +(x: Long): Long

32. #### def +(x: Int): Int

33. #### def +(x: Char): Int

34. #### def +(x: Short): Int

35. #### def +(x: Byte): Int

36. #### def +(x: String): String

37. #### def -(x: Double): Double

38. #### def -(x: Float): Float

39. #### def -(x: Long): Long

40. #### def -(x: Int): Int

41. #### def -(x: Char): Int

42. #### def -(x: Short): Int

43. #### def -(x: Byte): Int

44. #### def /(x: Double): Double

45. #### def /(x: Float): Float

46. #### def /(x: Long): Long

47. #### def /(x: Int): Int

48. #### def /(x: Char): Int

49. #### def /(x: Short): Int

50. #### def /(x: Byte): Int

51. #### def <(x: Double): Boolean

52. #### def <(x: Float): Boolean

53. #### def <(x: Long): Boolean

54. #### def <(x: Int): Boolean

55. #### def <(x: Char): Boolean

56. #### def <(x: Short): Boolean

57. #### def <(x: Byte): Boolean

58. #### def <<(x: Long): Int

59. #### def <<(x: Int): Int

60. #### def <=(x: Double): Boolean

61. #### def <=(x: Float): Boolean

62. #### def <=(x: Long): Boolean

63. #### def <=(x: Int): Boolean

64. #### def <=(x: Char): Boolean

65. #### def <=(x: Short): Boolean

66. #### def <=(x: Byte): Boolean

67. #### def ==(x: Double): Boolean

68. #### def ==(x: Float): Boolean

69. #### def ==(x: Long): Boolean

70. #### def ==(x: Int): Boolean

71. #### def ==(x: Char): Boolean

72. #### def ==(x: Short): Boolean

73. #### def ==(x: Byte): Boolean

74. #### final def ==(arg0: Any): Boolean

    Test two objects for equality.

    Test two objects for equality.

    returns

      `true` if the receiver object is equivalent to the argument; `false` otherwise.

    Definition Classes
      Any

75. #### def >(x: Double): Boolean

76. #### def >(x: Float): Boolean

77. #### def >(x: Long): Boolean

78. #### def >(x: Int): Boolean

79. #### def >(x: Char): Boolean

80. #### def >(x: Short): Boolean

81. #### def >(x: Byte): Boolean

82. #### def >=(x: Double): Boolean

83. #### def >=(x: Float): Boolean

84. #### def >=(x: Long): Boolean

85. #### def >=(x: Int): Boolean

86. #### def >=(x: Char): Boolean

87. #### def >=(x: Short): Boolean

88. #### def >=(x: Byte): Boolean

89. #### def >>(x: Long): Int

90. #### def >>(x: Int): Int

91. #### def >>>(x: Long): Int

92. #### def >>>(x: Int): Int

93. #### def ^(x: Long): Long

94. #### def ^(x: Int): Int

95. #### def ^(x: Char): Int

96. #### def ^(x: Short): Int

97. #### def ^(x: Byte): Int

98. #### final def asInstanceOf[T0]: T0

    Cast the receiver object to be of type `T0`.

    Cast the receiver object to be of type `T0`.

    Note that the success of a cast at runtime is modulo Scala's erasure semantics. Therefore the expression `1.asInstanceOf[String]` will throw a `ClassCastException` at runtime, while the expression `List(1).asInstanceOf[List[String]]` will not. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the requested type.

    returns

      the receiver object.

    Definition Classes
      Any
    Exceptions thrown
      ClassCastException

      if the receiver object is not an instance of the erasure of type `T0`.

99. #### def equals(arg0: Any): Boolean

    Compares the receiver object (`this`) with the argument object (`that`) for equivalence.

    Compares the receiver object (`this`) with the argument object (`that`) for equivalence.

    The default implementations of this method is an equivalence relation:

    - It is reflexive: for any instance `x` of type `Any`, `x.equals(x)` should return `true`.
    - It is symmetric: for any instances `x` and `y` of type `Any`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
    - It is transitive: for any instances `x`, `y`, and `z` of type `AnyRef` if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override `hashCode` to ensure that objects which are "equal" (`o1.equals(o2)` returns `true`) hash to the same Int. (`o1.hashCode.equals(o2.hashCode)`).

    returns

      `true` if the receiver object is equivalent to the argument; `false` otherwise.

    Definition Classes
      Any

100. #### def getClass(): Class[Int]

     Returns the runtime class representation of the object.

     Returns the runtime class representation of the object.

     returns

       a class object corresponding to the static type of the receiver

     Definition Classes
       Int → Any

101. #### def hashCode(): Int

     Calculate a hash code value for the object.

     Calculate a hash code value for the object.

     The default hashing algorithm is platform dependent.

     Note that it is allowed for two objects to have identical hash codes (`o1.hashCode.equals(o2.hashCode)`) yet not be equal (`o1.equals(o2)` returns `false`). A degenerate implementation could always return `0`. However, it is required that if two objects are equal (`o1.equals(o2)` returns `true`) that they have identical hash codes (`o1.hashCode.equals(o2.hashCode)`). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the `equals` method.

     returns

       the hash code value for this object.

     Definition Classes
       Any

102. #### final def isInstanceOf[T0]: Boolean

     Test whether the dynamic type of the receiver object is `T0`.

     Test whether the dynamic type of the receiver object is `T0`.

     Note that the result of the test is modulo Scala's erasure semantics. Therefore the expression `1.isInstanceOf[String]` will return `false`, while the expression `List(1).isInstanceOf[List[String]]` will return `true`. In the latter example, because the type argument is erased as part of compilation it is not possible to check whether the contents of the list are of the specified type.

     returns

       `true` if the receiver object is an instance of erasure of type `T0`; `false` otherwise.

     Definition Classes
       Any

103. #### def toByte: Byte

104. #### def toChar: Char

105. #### def toDouble: Double

106. #### def toFloat: Float

107. #### def toInt: Int

108. #### def toLong: Long

109. #### def toShort: Short

110. #### def toString(): String

     Returns a string representation of the object.

     Returns a string representation of the object.

     The default representation is platform dependent.

     returns

       a string representation of the object.

     Definition Classes
       Any

111. #### def unary_+: Int

112. #### def unary_-: Int

113. #### def unary_~: Int

114. #### def |(x: Long): Long

115. #### def |(x: Int): Int

116. #### def |(x: Char): Int

117. #### def |(x: Short): Int

118. #### def |(x: Byte): Int

### Inherited from AnyVal

### Inherited from Any