Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New method, UniqueMap.take() #97

Closed
samchon opened this issue Apr 26, 2022 · 0 comments
Closed

New method, UniqueMap.take() #97

samchon opened this issue Apr 26, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request experimental Experimental Feature
Projects

Comments

@samchon
Copy link
Owner

samchon commented Apr 26, 2022

export class HashMap<Key, T>
{
    public take(key: Key, generator: () => T): T
    {
        const it = this.find(key);
        return it.equals(this.end())
            ? this.emplace(key, generator()).first.second
            : it.second;
    }
}
@samchon samchon added the enhancement New feature or request label Apr 26, 2022
@samchon samchon self-assigned this Apr 26, 2022
@samchon samchon added this to To do in v2.5 Update via automation Apr 26, 2022
@samchon samchon added the experimental Experimental Feature label Apr 26, 2022
samchon added a commit that referenced this issue Apr 26, 2022
v2.5 Update automation moved this from To do to Done Apr 26, 2022
@samchon samchon changed the title New method, UniqueMap.get_or_set() New method, UniqueMap.take() Apr 27, 2022
samchon added a commit that referenced this issue Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental Experimental Feature
Projects
Development

No branches or pull requests

1 participant