TV RegenerateCompiledFunctions()
        {
            Func <TK, TV>   newMapper;
            Func <TK, bool> newexistenceTester;

            if (_dict.Count == 0)
            {
                newMapper          = x => { throw new KeyNotFoundException(); };
                newexistenceTester = x => false;
            }
            else
            {
                newMapper          = StaticMapperCompiler.CompileDictionaryFunc(_dict);
                newexistenceTester = StaticMapperCompiler.CompileHashSetFunc(_dict.Select(x => x.Key));
            }
            Interlocked.Exchange(ref _mapper, newMapper);
            Interlocked.Exchange(ref _existenceTester, newexistenceTester);
            if (_dict.Count > 0)
            {
                var anyKey = _dict.Keys.First();
                _existenceTester(anyKey);
                return(_mapper(anyKey));
            }
            return(default(TV));
        }
        private void RegenerateCompiledFunctions()
        {
            Func <T, bool> newexistenceTester;

            if (_set.Count == 0)
            {
                newexistenceTester = x => false;
            }
            else
            {
                newexistenceTester = StaticMapperCompiler.CompileHashSetFunc(_set);
            }
            Interlocked.Exchange(ref _existenceTester, newexistenceTester);
        }