Search Unity

[HashMap] What is the meaning of the boolean returned by TryAdd and TryGetValue for a NativeHashMap?

Discussion in 'Entity Component System' started by Mr-Mechanical, Jan 25, 2019.

  1. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
    Hi,

    I'm learning about hashmaps and I'm curious about what the boolean returned by TryAdd and TryGetValue for a NativeHashMap represent. If I were to guess TryAdd returns false if an item is already present for a key and TryGetValue returns false when a value isn't present for a given key, but I'm not sure.

    Thanks for the help.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,761
    You are correct on both
     
    Mr-Mechanical likes this.
  3. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
    Thank you I just wanted to make sure : )