MediaCodecInfo.CodecProfileLevel
public
static
final
class
MediaCodecInfo.CodecProfileLevel
extends Object
java.lang.Object | |
↳ | android.media.MediaCodecInfo.CodecProfileLevel |
Encapsulates the profiles available for a codec component.
You can get a set of MediaCodecInfo.CodecProfileLevel
objects for a given
MediaCodecInfo
object from the
MediaCodecInfo.CodecCapabilities.profileLevels
field.
Summary
Fields | |
---|---|
public
int |
level
The level of the media content. |
public
int |
profile
The profile of the media content. |
Public constructors | |
---|---|
CodecProfileLevel()
|
Public methods | |
---|---|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
int
|
hashCode()
Returns a hash code value for the object. |
Inherited methods | |
---|---|
Constants
AACObjectELD
public static final int AACObjectELD
Constant Value: 39 (0x00000027)
AACObjectERLC
public static final int AACObjectERLC
Constant Value: 17 (0x00000011)
AACObjectERScalable
public static final int AACObjectERScalable
Constant Value: 20 (0x00000014)
AACObjectHE
public static final int AACObjectHE
Constant Value: 5 (0x00000005)
AACObjectHE_PS
public static final int AACObjectHE_PS
Constant Value: 29 (0x0000001d)
AACObjectLC
public static final int AACObjectLC
Constant Value: 2 (0x00000002)
AACObjectLD
public static final int AACObjectLD
Constant Value: 23 (0x00000017)
AACObjectLTP
public static final int AACObjectLTP
Constant Value: 4 (0x00000004)
AACObjectMain
public static final int AACObjectMain
Constant Value: 1 (0x00000001)
AACObjectSSR
public static final int AACObjectSSR
Constant Value: 3 (0x00000003)
AACObjectScalable
public static final int AACObjectScalable
Constant Value: 6 (0x00000006)
AACObjectXHE
public static final int AACObjectXHE
xHE-AAC (includes USAC)
Constant Value: 42 (0x0000002a)
AC4Level0
public static final int AC4Level0
AC-4 codec level corresponding to mdcompat 0 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 1 (0x00000001)
AC4Level1
public static final int AC4Level1
AC-4 codec level corresponding to mdcompat 1 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 2 (0x00000002)
AC4Level2
public static final int AC4Level2
AC-4 codec level corresponding to mdcompat 2 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 4 (0x00000004)
AC4Level3
public static final int AC4Level3
AC-4 codec level corresponding to mdcompat 3 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 8 (0x00000008)
AC4Level4
public static final int AC4Level4
AC-4 codec level corresponding to mdcompat 4 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 16 (0x00000010)
AC4Profile00
public static final int AC4Profile00
AC-4 codec profile with bitstream_version 0 and presentation_version 0 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 257 (0x00000101)
AC4Profile10
public static final int AC4Profile10
AC-4 codec profile with bitstream_version 1 and presentation_version 0 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 513 (0x00000201)
AC4Profile11
public static final int AC4Profile11
AC-4 codec profile with bitstream_version 1 and presentation_version 1 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 514 (0x00000202)
AC4Profile21
public static final int AC4Profile21
AC-4 codec profile with bitstream_version 2 and presentation_version 1 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 1026 (0x00000402)
AC4Profile22
public static final int AC4Profile22
AC-4 codec profile with bitstream_version 2 and presentation_version 2 as per ETSI TS 103 190-2 v1.2.1
Constant Value: 1028 (0x00000404)
AV1Level33
public static final int AV1Level33
Constant Value: 128 (0x00000080)
AV1Level41
public static final int AV1Level41
Constant Value: 512 (0x00000200)
AV1Level42
public static final int AV1Level42
Constant Value: 1024 (0x00000400)
AV1Level43
public static final int AV1Level43
Constant Value: 2048 (0x00000800)
AV1Level51
public static final int AV1Level51
Constant Value: 8192 (0x00002000)
AV1Level52
public static final int AV1Level52
Constant Value: 16384 (0x00004000)
AV1Level53
public static final int AV1Level53
Constant Value: 32768 (0x00008000)
AV1Level6
public static final int AV1Level6
Constant Value: 65536 (0x00010000)
AV1Level61
public static final int AV1Level61
Constant Value: 131072 (0x00020000)
AV1Level62
public static final int AV1Level62
Constant Value: 262144 (0x00040000)
AV1Level63
public static final int AV1Level63
Constant Value: 524288 (0x00080000)
AV1Level7
public static final int AV1Level7
Constant Value: 1048576 (0x00100000)
AV1Level71
public static final int AV1Level71
Constant Value: 2097152 (0x00200000)
AV1Level72
public static final int AV1Level72
Constant Value: 4194304 (0x00400000)
AV1Level73
public static final int AV1Level73
Constant Value: 8388608 (0x00800000)
AV1ProfileMain10
public static final int AV1ProfileMain10
AV1 Main profile 4:2:0 10-bit See definition in AV1 Specification Annex A.
Constant Value: 2 (0x00000002)
AV1ProfileMain10HDR10
public static final int AV1ProfileMain10HDR10
AV1 Main profile 4:2:0 10-bit with HDR10.
Constant Value: 4096 (0x00001000)
AV1ProfileMain10HDR10Plus
public static final int AV1ProfileMain10HDR10Plus
AV1 Main profile 4:2:0 10-bit with HDR10Plus.
Constant Value: 8192 (0x00002000)
AV1ProfileMain8
public static final int AV1ProfileMain8
AV1 Main profile 4:2:0 8-bit See definition in AV1 Specification Annex A.
Constant Value: 1 (0x00000001)
AVCLevel22
public static final int AVCLevel22
Constant Value: 128 (0x00000080)
AVCLevel31
public static final int AVCLevel31
Constant Value: 512 (0x00000200)
AVCLevel32
public static final int AVCLevel32
Constant Value: 1024 (0x00000400)
AVCLevel41
public static final int AVCLevel41
Constant Value: 4096 (0x00001000)
AVCLevel42
public static final int AVCLevel42
Constant Value: 8192 (0x00002000)
AVCLevel5
public static final int AVCLevel5
Constant Value: 16384 (0x00004000)
AVCLevel51
public static final int AVCLevel51
Constant Value: 32768 (0x00008000)
AVCLevel52
public static final int AVCLevel52
Constant Value: 65536 (0x00010000)
AVCLevel6
public static final int AVCLevel6
Constant Value: 131072 (0x00020000)
AVCLevel61
public static final int AVCLevel61
Constant Value: 262144 (0x00040000)
AVCLevel62
public static final int AVCLevel62
Constant Value: 524288 (0x00080000)
AVCProfileBaseline
public static final int AVCProfileBaseline
AVC Baseline profile. See definition in H.264 recommendation, Annex A.
Constant Value: 1 (0x00000001)
AVCProfileConstrainedBaseline
public static final int AVCProfileConstrainedBaseline
AVC Constrained Baseline profile. See definition in H.264 recommendation, Annex A.
Constant Value: 65536 (0x00010000)
AVCProfileConstrainedHigh
public static final int AVCProfileConstrainedHigh
AVC Constrained High profile. See definition in H.264 recommendation, Annex A.
Constant Value: 524288 (0x00080000)
AVCProfileExtended
public static final int AVCProfileExtended
AVC Extended profile. See definition in H.264 recommendation, Annex A.
Constant Value: 4 (0x00000004)
AVCProfileHigh
public static final int AVCProfileHigh
AVC High profile. See definition in H.264 recommendation, Annex A.
Constant Value: 8 (0x00000008)
AVCProfileHigh10
public static final int AVCProfileHigh10
AVC High 10 profile. See definition in H.264 recommendation, Annex A.
Constant Value: 16 (0x00000010)
AVCProfileHigh422
public static final int AVCProfileHigh422
AVC High 4:2:2 profile. See definition in H.264 recommendation, Annex A.
Constant Value: 32 (0x00000020)
AVCProfileHigh444
public static final int AVCProfileHigh444
AVC High 4:4:4 profile. See definition in H.264 recommendation, Annex A.
Constant Value: 64 (0x00000040)
AVCProfileMain
public static final int AVCProfileMain
AVC Main profile. See definition in H.264 recommendation, Annex A.
Constant Value: 2 (0x00000002)
DTS_HDProfileHRA
public static final int DTS_HDProfileHRA
DTS codec profile for DTS HRA.
Constant Value: 1 (0x00000001)
DTS_HDProfileLBR
public static final int DTS_HDProfileLBR
DTS codec profile for DTS Express.
Constant Value: 2 (0x00000002)
DTS_HDProfileMA
public static final int DTS_HDProfileMA
DTS codec profile for DTS-HD Master Audio
Constant Value: 4 (0x00000004)
DTS_UHDProfileP1
public static final int DTS_UHDProfileP1
DTS codec profile for DTS:X Profile 1
Constant Value: 1 (0x00000001)
DTS_UHDProfileP2
public static final int DTS_UHDProfileP2
DTS codec profile for DTS:X Profile 2
Constant Value: 2 (0x00000002)
DolbyVisionLevel8k30
public static final int DolbyVisionLevel8k30
Constant Value: 1024 (0x00000400)
DolbyVisionLevel8k60
public static final int DolbyVisionLevel8k60
Constant Value: 2048 (0x00000800)
DolbyVisionLevelFhd24
public static final int DolbyVisionLevelFhd24
Constant Value: 4 (0x00000004)
DolbyVisionLevelFhd30
public static final int DolbyVisionLevelFhd30
Constant Value: 8 (0x00000008)
DolbyVisionLevelFhd60
public static final int DolbyVisionLevelFhd60
Constant Value: 16 (0x00000010)
DolbyVisionLevelHd24
public static final int DolbyVisionLevelHd24
Constant Value: 1 (0x00000001)
DolbyVisionLevelHd30
public static final int DolbyVisionLevelHd30
Constant Value: 2 (0x00000002)
DolbyVisionLevelUhd120
public static final int DolbyVisionLevelUhd120
Constant Value: 512 (0x00000200)
DolbyVisionLevelUhd24
public static final int DolbyVisionLevelUhd24
Constant Value: 32 (0x00000020)
DolbyVisionLevelUhd30
public static final int DolbyVisionLevelUhd30
Constant Value: 64 (0x00000040)
DolbyVisionLevelUhd48
public static final int DolbyVisionLevelUhd48
Constant Value: 128 (0x00000080)
DolbyVisionLevelUhd60
public static final int DolbyVisionLevelUhd60
Constant Value: 256 (0x00000100)
DolbyVisionProfileDvav110
public static final int DolbyVisionProfileDvav110
Dolby Vision AV1 profile
Constant Value: 1024 (0x00000400)
DolbyVisionProfileDvavPen
public static final int DolbyVisionProfileDvavPen
Constant Value: 2 (0x00000002)
DolbyVisionProfileDvavPer
public static final int DolbyVisionProfileDvavPer
Constant Value: 1 (0x00000001)
DolbyVisionProfileDvavSe
public static final int DolbyVisionProfileDvavSe
Constant Value: 512 (0x00000200)
DolbyVisionProfileDvheDen
public static final int DolbyVisionProfileDvheDen
Constant Value: 8 (0x00000008)
DolbyVisionProfileDvheDer
public static final int DolbyVisionProfileDvheDer
Constant Value: 4 (0x00000004)
DolbyVisionProfileDvheDtb
public static final int DolbyVisionProfileDvheDtb
Constant Value: 128 (0x00000080)
DolbyVisionProfileDvheDth
public static final int DolbyVisionProfileDvheDth
Constant Value: 64 (0x00000040)
DolbyVisionProfileDvheDtr
public static final int DolbyVisionProfileDvheDtr
Constant Value: 16 (0x00000010)
DolbyVisionProfileDvheSt
public static final int DolbyVisionProfileDvheSt
Constant Value: 256 (0x00000100)
DolbyVisionProfileDvheStn
public static final int DolbyVisionProfileDvheStn
Constant Value: 32 (0x00000020)
H263Level10
public static final int H263Level10
Constant Value: 1 (0x00000001)
H263Level20
public static final int H263Level20
Constant Value: 2 (0x00000002)
H263Level30
public static final int H263Level30
Constant Value: 4 (0x00000004)
H263Level40
public static final int H263Level40
Constant Value: 8 (0x00000008)
H263Level45
public static final int H263Level45
Constant Value: 16 (0x00000010)
H263Level50
public static final int H263Level50
Constant Value: 32 (0x00000020)
H263Level60
public static final int H263Level60
Constant Value: 64 (0x00000040)
H263Level70
public static final int H263Level70
Constant Value: 128 (0x00000080)
H263ProfileBackwardCompatible
public static final int H263ProfileBackwardCompatible
Constant Value: 4 (0x00000004)
H263ProfileBaseline
public static final int H263ProfileBaseline
Constant Value: 1 (0x00000001)
H263ProfileH320Coding
public static final int H263ProfileH320Coding
Constant Value: 2 (0x00000002)
H263ProfileHighCompression
public static final int H263ProfileHighCompression
Constant Value: 32 (0x00000020)
H263ProfileHighLatency
public static final int H263ProfileHighLatency
Constant Value: 256 (0x00000100)
H263ProfileISWV2
public static final int H263ProfileISWV2
Constant Value: 8 (0x00000008)
H263ProfileISWV3
public static final int H263ProfileISWV3
Constant Value: 16 (0x00000010)
H263ProfileInterlace
public static final int H263ProfileInterlace
Constant Value: 128 (0x00000080)
H263ProfileInternet
public static final int H263ProfileInternet
Constant Value: 64 (0x00000040)
HEVCHighTierLevel1
public static final int HEVCHighTierLevel1
Constant Value: 2 (0x00000002)
HEVCHighTierLevel2
public static final int HEVCHighTierLevel2
Constant Value: 8 (0x00000008)
HEVCHighTierLevel21
public static final int HEVCHighTierLevel21
Constant Value: 32 (0x00000020)
HEVCHighTierLevel3
public static final int HEVCHighTierLevel3
Constant Value: 128 (0x00000080)
HEVCHighTierLevel31
public static final int HEVCHighTierLevel31
Constant Value: 512 (0x00000200)
HEVCHighTierLevel4
public static final int HEVCHighTierLevel4
Constant Value: 2048 (0x00000800)
HEVCHighTierLevel41
public static final int HEVCHighTierLevel41
Constant Value: 8192 (0x00002000)
HEVCHighTierLevel5
public static final int HEVCHighTierLevel5
Constant Value: 32768 (0x00008000)
HEVCHighTierLevel51
public static final int HEVCHighTierLevel51
Constant Value: 131072 (0x00020000)
HEVCHighTierLevel52
public static final int HEVCHighTierLevel52
Constant Value: 524288 (0x00080000)
HEVCHighTierLevel6
public static final int HEVCHighTierLevel6
Constant Value: 2097152 (0x00200000)
HEVCHighTierLevel61
public static final int HEVCHighTierLevel61
Constant Value: 8388608 (0x00800000)
HEVCHighTierLevel62
public static final int HEVCHighTierLevel62
Constant Value: 33554432 (0x02000000)
HEVCMainTierLevel1
public static final int HEVCMainTierLevel1
Constant Value: 1 (0x00000001)
HEVCMainTierLevel2
public static final int HEVCMainTierLevel2
Constant Value: 4 (0x00000004)
HEVCMainTierLevel21
public static final int HEVCMainTierLevel21
Constant Value: 16 (0x00000010)
HEVCMainTierLevel3
public static final int HEVCMainTierLevel3
Constant Value: 64 (0x00000040)
HEVCMainTierLevel31
public static final int HEVCMainTierLevel31
Constant Value: 256 (0x00000100)
HEVCMainTierLevel4
public static final int HEVCMainTierLevel4
Constant Value: 1024 (0x00000400)
HEVCMainTierLevel41
public static final int HEVCMainTierLevel41
Constant Value: 4096 (0x00001000)
HEVCMainTierLevel5
public static final int HEVCMainTierLevel5
Constant Value: 16384 (0x00004000)
HEVCMainTierLevel51
public static final int HEVCMainTierLevel51
Constant Value: 65536 (0x00010000)
HEVCMainTierLevel52
public static final int HEVCMainTierLevel52
Constant Value: 262144 (0x00040000)
HEVCMainTierLevel6
public static final int HEVCMainTierLevel6
Constant Value: 1048576 (0x00100000)
HEVCMainTierLevel61
public static final int HEVCMainTierLevel61
Constant Value: 4194304 (0x00400000)
HEVCMainTierLevel62
public static final int HEVCMainTierLevel62
Constant Value: 16777216 (0x01000000)
HEVCProfileMain
public static final int HEVCProfileMain
Constant Value: 1 (0x00000001)
HEVCProfileMain10
public static final int HEVCProfileMain10
Constant Value: 2 (0x00000002)
HEVCProfileMain10HDR10
public static final int HEVCProfileMain10HDR10
Constant Value: 4096 (0x00001000)
HEVCProfileMain10HDR10Plus
public static final int HEVCProfileMain10HDR10Plus
Constant Value: 8192 (0x00002000)
HEVCProfileMainStill
public static final int HEVCProfileMainStill
Constant Value: 4 (0x00000004)
MPEG2LevelH14
public static final int MPEG2LevelH14
Constant Value: 2 (0x00000002)
MPEG2LevelHL
public static final int MPEG2LevelHL
Constant Value: 3 (0x00000003)
MPEG2LevelHP
public static final int MPEG2LevelHP
Constant Value: 4 (0x00000004)
MPEG2LevelLL
public static final int MPEG2LevelLL
Constant Value: 0 (0x00000000)
MPEG2LevelML
public static final int MPEG2LevelML
Constant Value: 1 (0x00000001)
MPEG2Profile422
public static final int MPEG2Profile422
Constant Value: 2 (0x00000002)
MPEG2ProfileHigh
public static final int MPEG2ProfileHigh
Constant Value: 5 (0x00000005)
MPEG2ProfileMain
public static final int MPEG2ProfileMain
Constant Value: 1 (0x00000001)
MPEG2ProfileSNR
public static final int MPEG2ProfileSNR
Constant Value: 3 (0x00000003)
MPEG2ProfileSimple
public static final int MPEG2ProfileSimple
Constant Value: 0 (0x00000000)
MPEG2ProfileSpatial
public static final int MPEG2ProfileSpatial
Constant Value: 4 (0x00000004)
MPEG4Level0
public static final int MPEG4Level0
Constant Value: 1 (0x00000001)
MPEG4Level0b
public static final int MPEG4Level0b
Constant Value: 2 (0x00000002)
MPEG4Level1
public static final int MPEG4Level1
Constant Value: 4 (0x00000004)
MPEG4Level2
public static final int MPEG4Level2
Constant Value: 8 (0x00000008)
MPEG4Level3
public static final int MPEG4Level3
Constant Value: 16 (0x00000010)
MPEG4Level3b
public static final int MPEG4Level3b
Constant Value: 24 (0x00000018)
MPEG4Level4
public static final int MPEG4Level4
Constant Value: 32 (0x00000020)
MPEG4Level4a
public static final int MPEG4Level4a
Constant Value: 64 (0x00000040)
MPEG4Level5
public static final int MPEG4Level5
Constant Value: 128 (0x00000080)
MPEG4Level6
public static final int MPEG4Level6
Constant Value: 256 (0x00000100)
MPEG4ProfileAdvancedCoding
public static final int MPEG4ProfileAdvancedCoding
Constant Value: 4096 (0x00001000)
MPEG4ProfileAdvancedCore
public static final int MPEG4ProfileAdvancedCore
Constant Value: 8192 (0x00002000)
MPEG4ProfileAdvancedRealTime
public static final int MPEG4ProfileAdvancedRealTime
Constant Value: 1024 (0x00000400)
MPEG4ProfileAdvancedScalable
public static final int MPEG4ProfileAdvancedScalable
Constant Value: 16384 (0x00004000)
MPEG4ProfileAdvancedSimple
public static final int MPEG4ProfileAdvancedSimple
Constant Value: 32768 (0x00008000)
MPEG4ProfileBasicAnimated
public static final int MPEG4ProfileBasicAnimated
Constant Value: 256 (0x00000100)
MPEG4ProfileCore
public static final int MPEG4ProfileCore
Constant Value: 4 (0x00000004)
MPEG4ProfileCoreScalable
public static final int MPEG4ProfileCoreScalable
Constant Value: 2048 (0x00000800)
MPEG4ProfileHybrid
public static final int MPEG4ProfileHybrid
Constant Value: 512 (0x00000200)
MPEG4ProfileMain
public static final int MPEG4ProfileMain
Constant Value: 8 (0x00000008)
MPEG4ProfileNbit
public static final int MPEG4ProfileNbit
Constant Value: 16 (0x00000010)
MPEG4ProfileScalableTexture
public static final int MPEG4ProfileScalableTexture
Constant Value: 32 (0x00000020)
MPEG4ProfileSimple
public static final int MPEG4ProfileSimple
Constant Value: 1 (0x00000001)
MPEG4ProfileSimpleFBA
public static final int MPEG4ProfileSimpleFBA
Constant Value: 128 (0x00000080)
MPEG4ProfileSimpleFace
public static final int MPEG4ProfileSimpleFace
Constant Value: 64 (0x00000040)
MPEG4ProfileSimpleScalable
public static final int MPEG4ProfileSimpleScalable
Constant Value: 2 (0x00000002)
VP8Level_Version0
public static final int VP8Level_Version0
Constant Value: 1 (0x00000001)
VP8Level_Version1
public static final int VP8Level_Version1
Constant Value: 2 (0x00000002)
VP8Level_Version2
public static final int VP8Level_Version2
Constant Value: 4 (0x00000004)
VP8Level_Version3
public static final int VP8Level_Version3
Constant Value: 8 (0x00000008)
VP8ProfileMain
public static final int VP8ProfileMain
Constant Value: 1 (0x00000001)
VP9Level41
public static final int VP9Level41
Constant Value: 128 (0x00000080)
VP9Level51
public static final int VP9Level51
Constant Value: 512 (0x00000200)
VP9Level52
public static final int VP9Level52
Constant Value: 1024 (0x00000400)
VP9Level61
public static final int VP9Level61
Constant Value: 4096 (0x00001000)
VP9Level62
public static final int VP9Level62
Constant Value: 8192 (0x00002000)
VP9Profile0
public static final int VP9Profile0
VP9 Profile 0 4:2:0 8-bit
Constant Value: 1 (0x00000001)
VP9Profile1
public static final int VP9Profile1
VP9 Profile 1 4:2:2 8-bit
Constant Value: 2 (0x00000002)
VP9Profile2
public static final int VP9Profile2
VP9 Profile 2 4:2:0 10-bit
Constant Value: 4 (0x00000004)
VP9Profile2HDR
public static final int VP9Profile2HDR
VP9 Profile 2 4:2:0 10-bit HDR
Constant Value: 4096 (0x00001000)
VP9Profile2HDR10Plus
public static final int VP9Profile2HDR10Plus
VP9 Profile 2 4:2:0 10-bit HDR10Plus
Constant Value: 16384 (0x00004000)
VP9Profile3
public static final int VP9Profile3
VP9 Profile 3 4:2:2 10-bit
Constant Value: 8 (0x00000008)
VP9Profile3HDR
public static final int VP9Profile3HDR
VP9 Profile 3 4:2:2 10-bit HDR
Constant Value: 8192 (0x00002000)
VP9Profile3HDR10Plus
public static final int VP9Profile3HDR10Plus
VP9 Profile 3 4:2:2 10-bit HDR10Plus
Constant Value: 32768 (0x00008000)
Fields
level
public int level
The level of the media content. Depending on the type of media this can be
one of the level values defined in this class.
Note that VP9 decoder on platforms before Build.VERSION_CODES.N
may
not advertise a profile level support. For those VP9 decoders, please use
VideoCapabilities
to determine the codec capabilities.
profile
public int profile
The profile of the media content. Depending on the type of media this can be one of the profile values defined in this class.
Public constructors
CodecProfileLevel
public CodecProfileLevel ()
Public methods
equals
public boolean equals (Object obj)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
obj |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
hashCode
public int hashCode ()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap
.
The general contract of hashCode
is:
- Whenever it is invoked on the same object more than once during
an execution of a Java application, the
hashCode
method must consistently return the same integer, provided no information used inequals
comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the
equals
method, then calling thehashCode
method on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal
according to the
equals
method, then calling thehashCode
method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns | |
---|---|
int |
a hash code value for this object. |