Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
collections.js - differance between SortedMap and SortedArrayMap

I was searching for a sorted map in javascript and found collections.js's implementation - SortedMap. I also see that they have something called SortedArrayMap.

In the description of SortedArrayMap it says:

A map of key value pairs, sorted by key, backed by an array.

(Source)

And in the description of SortedMap it says:

A map with entries sorted by key.

What exactly does backed by an array mean? and what is the difference between it and the normal SortedMap?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

At first glance, SortedArrayMap uses a binary search strategy to maintain the order of the entries and is backed by an array, which means that use an array as a basic data structure(to maintain data of key). So that means in the end, that it uses a map based on SortedArray class.

However, SortedMap is a general key/value collection, where you can access values with their relative key(quick access rather than an array order).

Anyway, if you want to dive a bit more into this topic, you can find a very good explanation on the is the official website of collections.js,

about 4 years ago · Juan Pablo Isaza Relatório

0

As stated on http://www.collectionsjs.com/map, maps are different as they work like dictionaries but accepting even objects as a key.

Reading the Dict documentation on http://www.collectionsjs.com/dict we understand that:

A dictionary is a specialized map. The keys are required to be strings.

An array is simply a data structure where you can insert anything using a simple push(thingToInsert). Items inserted into an Array are just values without a key to point to them.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda