IN
- Type of objects to extract the key from.@Deprecated @Internal public class HashSelector<IN> extends Object implements KeySelector<IN,Integer>
KeySelector
that returns the Object.hashCode()
of the returned
key.Constructor and Description |
---|
HashSelector(KeySelector<IN,?> keySelector)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Integer |
getKey(IN value)
Deprecated.
User-defined function that deterministically extracts the key from an object.
|
public HashSelector(KeySelector<IN,?> keySelector)
public Integer getKey(IN value) throws Exception
KeySelector
For example for a class:
public class Word { String word; int count; }
The key extractor could return the word as a key to group all Word objects by the String they contain.
The code would look like this
public String getKey(Word w) { return w.word; }
getKey
in interface KeySelector<IN,Integer>
value
- The object to get the key from.Exception
- Throwing an exception will cause the execution of the respective task to
fail, and trigger recovery or cancellation of the program.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.