scala

Short

final class Short extends AnyVal

Short, a 16-bit signed integer (equivalent to Java's short primitive type) is a subtype of AnyVal. Instances of Short are not represented by an object in the underlying runtime system.

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

Source
Short.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Short
  2. AnyVal
  3. Any
Visibility
  1. Public
  2. All

Value Members

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

    returns

    true if this value is not equal to x, false otherwise

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

    returns

    true if this value is not equal to x, false otherwise

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

    returns

    true if this value is not equal to x, false otherwise

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

    returns

    true if this value is not equal to x, false otherwise

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

    returns

    true if this value is not equal to x, false otherwise

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

    returns

    true if this value is not equal to x, false otherwise

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

    returns

    true if this value is not equal to x, false otherwise

  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 and null.

    Equivalent to x.hashCode except for boxed numeric types and null. 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. For null returns a hashcode where null.hashCode throws a NullPointerException.

    returns

    a hash value consistent with ==

    Definition Classes
    Any
  10. def %(x: Double): Double

    returns

    the remainder of the division of this value by x

  11. def %(x: Float): Float

    returns

    the remainder of the division of this value by x

  12. def %(x: Long): Long

    returns

    the remainder of the division of this value by x

  13. def %(x: Int): Int

    returns

    the remainder of the division of this value by x

  14. def %(x: Char): Int

    returns

    the remainder of the division of this value by x

  15. def %(x: Short): Int

    returns

    the remainder of the division of this value by x

  16. def %(x: Byte): Int

    returns

    the remainder of the division of this value by x

  17. def &(x: Long): Long

    returns

    the bitwise AND of this value and x

    Example:
    1. (0xf0 & 0xaa) == 0xa0
      // in binary:   11110000
      //            & 10101010
      //              --------
      //              10100000
      
  18. def &(x: Int): Int

    returns

    the bitwise AND of this value and x

    Example:
    1. (0xf0 & 0xaa) == 0xa0
      // in binary:   11110000
      //            & 10101010
      //              --------
      //              10100000
      
  19. def &(x: Char): Int

    returns

    the bitwise AND of this value and x

    Example:
    1. (0xf0 & 0xaa) == 0xa0
      // in binary:   11110000
      //            & 10101010
      //              --------
      //              10100000
      
  20. def &(x: Short): Int

    returns

    the bitwise AND of this value and x

    Example:
    1. (0xf0 & 0xaa) == 0xa0
      // in binary:   11110000
      //            & 10101010
      //              --------
      //              10100000
      
  21. def &(x: Byte): Int

    returns

    the bitwise AND of this value and x

    Example:
    1. (0xf0 & 0xaa) == 0xa0
      // in binary:   11110000
      //            & 10101010
      //              --------
      //              10100000
      
  22. def *(x: Double): Double

    returns

    the product of this value and x

  23. def *(x: Float): Float

    returns

    the product of this value and x

  24. def *(x: Long): Long

    returns

    the product of this value and x

  25. def *(x: Int): Int

    returns

    the product of this value and x

  26. def *(x: Char): Int

    returns

    the product of this value and x

  27. def *(x: Short): Int

    returns

    the product of this value and x

  28. def *(x: Byte): Int

    returns

    the product of this value and x

  29. def +(x: Double): Double

    returns

    the sum of this value and x

  30. def +(x: Float): Float

    returns

    the sum of this value and x

  31. def +(x: Long): Long

    returns

    the sum of this value and x

  32. def +(x: Int): Int

    returns

    the sum of this value and x

  33. def +(x: Char): Int

    returns

    the sum of this value and x

  34. def +(x: Short): Int

    returns

    the sum of this value and x

  35. def +(x: Byte): Int

    returns

    the sum of this value and x

  36. def +(x: String): String

  37. def -(x: Double): Double

    returns

    the difference of this value and x

  38. def -(x: Float): Float

    returns

    the difference of this value and x

  39. def -(x: Long): Long

    returns

    the difference of this value and x

  40. def -(x: Int): Int

    returns

    the difference of this value and x

  41. def -(x: Char): Int

    returns

    the difference of this value and x

  42. def -(x: Short): Int

    returns

    the difference of this value and x

  43. def -(x: Byte): Int

    returns

    the difference of this value and x

  44. def /(x: Double): Double

    returns

    the quotient of this value and x

  45. def /(x: Float): Float

    returns

    the quotient of this value and x

  46. def /(x: Long): Long

    returns

    the quotient of this value and x

  47. def /(x: Int): Int

    returns

    the quotient of this value and x

  48. def /(x: Char): Int

    returns

    the quotient of this value and x

  49. def /(x: Short): Int

    returns

    the quotient of this value and x

  50. def /(x: Byte): Int

    returns

    the quotient of this value and x

  51. def <(x: Double): Boolean

    returns

    true if this value is less than x, false otherwise

  52. def <(x: Float): Boolean

    returns

    true if this value is less than x, false otherwise

  53. def <(x: Long): Boolean

    returns

    true if this value is less than x, false otherwise

  54. def <(x: Int): Boolean

    returns

    true if this value is less than x, false otherwise

  55. def <(x: Char): Boolean

    returns

    true if this value is less than x, false otherwise

  56. def <(x: Short): Boolean

    returns

    true if this value is less than x, false otherwise

  57. def <(x: Byte): Boolean

    returns

    true if this value is less than x, false otherwise

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

    returns

    this value bit-shifted left by the specified number of bits, filling in the new right bits with zeroes.

    Example:
    1.  6 << 3 == 48 // in binary: 0110 << 3 == 0110000 
      
  59. def <<(x: Int): Int

    returns

    this value bit-shifted left by the specified number of bits, filling in the new right bits with zeroes.

    Example:
    1.  6 << 3 == 48 // in binary: 0110 << 3 == 0110000 
      
  60. def <=(x: Double): Boolean

    returns

    true if this value is less than or equal to x, false otherwise

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

    returns

    true if this value is less than or equal to x, false otherwise

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

    returns

    true if this value is less than or equal to x, false otherwise

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

    returns

    true if this value is less than or equal to x, false otherwise

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

    returns

    true if this value is less than or equal to x, false otherwise

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

    returns

    true if this value is less than or equal to x, false otherwise

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

    returns

    true if this value is less than or equal to x, false otherwise

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

    returns

    true if this value is equal x, false otherwise

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

    returns

    true if this value is equal x, false otherwise

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

    returns

    true if this value is equal x, false otherwise

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

    returns

    true if this value is equal x, false otherwise

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

    returns

    true if this value is equal x, false otherwise

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

    returns

    true if this value is equal x, false otherwise

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

    returns

    true if this value is equal x, false otherwise

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

    Test two objects for equality.

    Test two objects for equality. The expression x == that is equivalent to if (x eq null) that eq null else x.equals(that).

    returns

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

    Definition Classes
    Any
  75. def >(x: Double): Boolean

    returns

    true if this value is greater than x, false otherwise

  76. def >(x: Float): Boolean

    returns

    true if this value is greater than x, false otherwise

  77. def >(x: Long): Boolean

    returns

    true if this value is greater than x, false otherwise

  78. def >(x: Int): Boolean

    returns

    true if this value is greater than x, false otherwise

  79. def >(x: Char): Boolean

    returns

    true if this value is greater than x, false otherwise

  80. def >(x: Short): Boolean

    returns

    true if this value is greater than x, false otherwise

  81. def >(x: Byte): Boolean

    returns

    true if this value is greater than x, false otherwise

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

    returns

    true if this value is greater than or equal to x, false otherwise

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

    returns

    true if this value is greater than or equal to x, false otherwise

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

    returns

    true if this value is greater than or equal to x, false otherwise

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

    returns

    true if this value is greater than or equal to x, false otherwise

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

    returns

    true if this value is greater than or equal to x, false otherwise

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

    returns

    true if this value is greater than or equal to x, false otherwise

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

    returns

    true if this value is greater than or equal to x, false otherwise

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

    returns

    this value bit-shifted left by the specified number of bits, filling in the right bits with the same value as the left-most bit of this. The effect of this is to retain the sign of the value.

    Example:
    1. -21 >> 3 == -3
      // in binary: 11111111 11111111 11111111 11101011 >> 3 ==
      //            11111111 11111111 11111111 11111101
      
  90. def >>(x: Int): Int

    returns

    this value bit-shifted left by the specified number of bits, filling in the right bits with the same value as the left-most bit of this. The effect of this is to retain the sign of the value.

    Example:
    1. -21 >> 3 == -3
      // in binary: 11111111 11111111 11111111 11101011 >> 3 ==
      //            11111111 11111111 11111111 11111101
      
  91. def >>>(x: Long): Int

    returns

    this value bit-shifted right by the specified number of bits, filling the new left bits with zeroes.

    Examples:
    1. -21 >>> 3 == 536870909
      // in binary: 11111111 11111111 11111111 11101011 >>> 3 ==
      //            00011111 11111111 11111111 11111101
      
    2. ,
    3.  21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 
      
  92. def >>>(x: Int): Int

    returns

    this value bit-shifted right by the specified number of bits, filling the new left bits with zeroes.

    Examples:
    1. -21 >>> 3 == 536870909
      // in binary: 11111111 11111111 11111111 11101011 >>> 3 ==
      //            00011111 11111111 11111111 11111101
      
    2. ,
    3.  21 >>> 3 == 2 // in binary: 010101 >>> 3 == 010 
      
  93. def ^(x: Long): Long

    returns

    the bitwise XOR of this value and x

    Example:
    1. (0xf0 ^ 0xaa) == 0x5a
      // in binary:   11110000
      //            ^ 10101010
      //              --------
      //              01011010
      
  94. def ^(x: Int): Int

    returns

    the bitwise XOR of this value and x

    Example:
    1. (0xf0 ^ 0xaa) == 0x5a
      // in binary:   11110000
      //            ^ 10101010
      //              --------
      //              01011010
      
  95. def ^(x: Char): Int

    returns

    the bitwise XOR of this value and x

    Example:
    1. (0xf0 ^ 0xaa) == 0x5a
      // in binary:   11110000
      //            ^ 10101010
      //              --------
      //              01011010
      
  96. def ^(x: Short): Int

    returns

    the bitwise XOR of this value and x

    Example:
    1. (0xf0 ^ 0xaa) == 0x5a
      // in binary:   11110000
      //            ^ 10101010
      //              --------
      //              01011010
      
  97. def ^(x: Byte): Int

    returns

    the bitwise XOR of this value and x

    Example:
    1. (0xf0 ^ 0xaa) == 0x5a
      // in binary:   11110000
      //            ^ 10101010
      //              --------
      //              01011010
      
  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.

    Any implementation of this method should be 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[Short]

    Returns the runtime class representation of the object.

    Returns the runtime class representation of the object.

    returns

    a class object corresponding to the runtime type of the receiver.

    Definition Classes
    ShortAny
  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

    returns

    this value, unmodified

  112. def unary_-: Int

    returns

    the negation of this value

  113. def unary_~: Int

    returns

    the bitwise negation of this value

    Example:
    1. ~5 == -6
      // in binary: ~00000101 ==
      //             11111010
      
  114. def |(x: Long): Long

    returns

    the bitwise OR of this value and x

    Example:
    1. (0xf0 | 0xaa) == 0xfa
      // in binary:   11110000
      //            | 10101010
      //              --------
      //              11111010
      
  115. def |(x: Int): Int

    returns

    the bitwise OR of this value and x

    Example:
    1. (0xf0 | 0xaa) == 0xfa
      // in binary:   11110000
      //            | 10101010
      //              --------
      //              11111010
      
  116. def |(x: Char): Int

    returns

    the bitwise OR of this value and x

    Example:
    1. (0xf0 | 0xaa) == 0xfa
      // in binary:   11110000
      //            | 10101010
      //              --------
      //              11111010
      
  117. def |(x: Short): Int

    returns

    the bitwise OR of this value and x

    Example:
    1. (0xf0 | 0xaa) == 0xfa
      // in binary:   11110000
      //            | 10101010
      //              --------
      //              11111010
      
  118. def |(x: Byte): Int

    returns

    the bitwise OR of this value and x

    Example:
    1. (0xf0 | 0xaa) == 0xfa
      // in binary:   11110000
      //            | 10101010
      //              --------
      //              11111010
      

Inherited from AnyVal

Inherited from Any