🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

exampleSet.getExampleFromId returns null

User: "navyboys"
New Altair Community Member
Updated by Jocelyn
I want to retrieve an example object by the "exampleSet.getExampleFromId" method, but got an NullPointerException error, anybody can tell me how to use this method?

Sample source likes this (Simplified Version)
-------------------------------------------------------------------------------------
Set<Double> exampleIds = new HashSet<Double>(exampleSet.size());

for (Example example: exampleSet) {
exampleIds.add(example.getId());
}

for (Double exampleId: exampleIds) {
Example example = exampleSet.getExampleFromId(exampleId);
example.getWeight();
}
-------------------------------------------------------------------------------------

Find more posts tagged with

Sort by:
1 - 3 of 31
    User: "fischer"
    New Altair Community Member
    Hi,

    hard to tell without an error message. Does your example set actually have an id attribute?

    Best,
    Simon
    User: "fischer"
    New Altair Community Member
    oh, and it looks like you did not call ExmpleSet.remapIds().

    Best,
    Simon
    User: "navyboys"
    New Altair Community Member
    OP
    Hi, Simon

    Problem resolved by adding ExampleSet.remapIds().
    Thank you very much.

    Yours ZHENG