Questions tagged [map]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

spatial element count data structure eg: R-Tree, with filtering

Background: The application is a web map application with a LeafletJS front-end and NodeJS back-end with Postgres database. The application is to be used on both desktops and smartphones/ tablets in ...
1
vote
4answers
99 views

filter + map api design

I am writing a library call that will allow you to filter and map in the same iteration of the loop, this is async/callback style in Java. The problem of course is that for filtering we usually return ...
2
votes
0answers
50 views

java hashtable extending to support duplicates

I have to maintain an old application and have to extend some modules. There is an hashtable that is used for maintaining/holding some objects as representation of running (real) processes (don't see ...
1
vote
2answers
94 views

When define locale text file, language key (eg:'en') or text key (eg:'WELCOME_MESSAGE'), which one should be the outermost key?

When define a locale text map, I can use: 1.locale key first { "en":{ "WELCOME_TO_USE_THIS_APP":"Welcome to use this app,...", "SOME_OTHER_TEXT":"fsdfsf..." }, "es":{ "...
3
votes
5answers
1k views

Use POJO or Map when there is a finite number of known keys?

I have some set of data with key-value pairs, but there is only a finite and known set of keys, all of the key should always be present on that data, and they all have the same type for the value. ...
9
votes
1answer
12k views

What is the use of DTO instead of Entity?

I am working on RCP application, I'm new to this application. Spring beans are used to write business logic to save/fetch entities. But, instead of sending entities directly to client we are ...
0
votes
1answer
176 views

How to avoid Global State with a world map?

This is a conceptual problem I'm having general difficulty with, and I'd like to look at an example that can hopefully help clarify this: using a map to represent an alterable game world. For ...
4
votes
4answers
546 views

Hash map without collision check

A few days ago I found a fun fact, that finding a collision of 256-bit hash using brute-force is physically impossible in solar system. That made me think, what would happen if we used a good (...
25
votes
9answers
6k views

How to communicate that insertion order matters in a map?

I'm fetching a set of tuples from the database, and putting it into a map. The database query is costly. There is no obvious natural ordering of the elements in the map, but insertion order matters ...
1
vote
1answer
1k views

MVP: Should a View have multiple Presenters?

Is it desirable (from an architectural standpoint) to have more than one Presenter communicating with a View? In my particular situation I have one presenter communicating with multiple views, and ...
2
votes
0answers
155 views

Self hosting map vector tiles for web application

I'm building a web application, which involves (currently) a REST backend and a frontend SPA. The backend is hosting massive geo-enabled data, and the frontend is displaying it on a mapbox map. I'm ...
1
vote
2answers
475 views

Map/store run time ID for objects

What I want to achieve: I need to obtain a run time (unique) id for "any object" (for classes either in java SE, classes I have created or classes provided by other third parties... any instance of a ...
1
vote
4answers
7k views

Is it possible to create instance of an Interface(e.g-Map Interface)?If it is then how?

In most Java code, I see people declare Java objects like this: Map<String, String> hashMap = new HashMap<>(); instead of: HashMap<String, String> hashMap = new HashMap<>(); ...
0
votes
1answer
331 views

Javascript queue-like key-pair sorted collection

I'm looking for a collection that would suit my scenario: I will be inserting key-value pairs (both integers) of ID and timestamp. The ID must be unique. At some interval I will be checking that ...
1
vote
0answers
181 views

Data structure for fast bi-directional SHA-1 to SHA-3 mapping

What data structure would be best choice for fast and performant bidirectional SHA-1 to SHA-3 mapping? Or in other words fixed-length string to fixed-length string mapping? To be more precise: ...
5
votes
2answers
228 views

Two “flavours” of undefined in JavaScript shown by trying to map them

Why does the 1st map method below treat element #2 as undefined but the 2nd map method does not? const a = [undefined,,42]; // Note the two consecutive commas. console.log(a.map(x=>x)); ...
3
votes
2answers
853 views

A multi-processing approach to listing the occurrences of words in a text file

A classical problem: read the words from a text file and list the occurence of each unique word in the file. I solved the problem using a hash map, but how could the performance be improved? I ...
6
votes
3answers
202 views

Are we “allowed” to use methods on JavaScript maps (the data type) and if so are there any new rules?

JavaScript maps (the data type, not the array method) seem set up to accept data (key/value pairs) but not necessarily methods. At least they're not advertised that way. However, we can put methods ...
1
vote
3answers
162 views

How to avoid having an object id as the key in a map and also inside the object itself?

I am using a JSON map to save objects (e.g. users) whose ids are the keys of the map but the object (user) itself also contains the id. JSON { "john":{ "username":"john", "age":30 }...
0
votes
2answers
557 views

Can hashtable be used for implementing multimap?

Is it correct that hashtables assume no key is shared between more than one records? In other words, can hashtables be used for implementing multimaps? When using a hashtable, can't multiple records ...
0
votes
1answer
139 views

Mapping Lat & Long for daily history overview on Google Maps

So i have the following data for over a month ( an app that registers all i do) Lat Long On ( DateTime ) Now i am interested in creating a history on plotting the points on Google Maps, similar to ...
1
vote
1answer
236 views

Memory usage on Creating a Travian like map and 441 Buttons on a page

I'm creating A Map like Travian on Xamarin forms My map is something like 5000*5000 The way I want to do that is to load part of the map (21*21) of the big map where the current village is the ...
3
votes
2answers
165 views

What is the most idiomatic way to iterate collection with different action for first element?

Sometimes we meet a situation where we should iterate (or map) over a collection, applying the same procedure (function) for all elements except the first one. The simplest example is finding the max ...
0
votes
2answers
1k views

Implementing map with tail recursion

I am trying to solve this exercise. It is about reimplementing the map function in haskell for learning purpose. I found a solution which doesn't browse all the elements of the list (simple linked ...
1
vote
2answers
118 views

Type of map for Try[T]

I was looking at the type of map for Try[T] in Scala, which is: def map[S](f: T=>S): Try[S] From Haskell, I am used to the type of map being: map :: (a->b)->[a]->[b] This seems very ...
1
vote
1answer
61 views

How to map collection of unique large numbers to an array?

I have a list of unique 8 byte random ids and new ids are generated often. Let's say that the total number of ids can become at most N (let's say 100,000). Now, I want to map each of these ids to a ...
5
votes
1answer
2k views

Storing pairs in a map

If I have a Pair class like this: class Pair<K, L>{ public final K a; public final L b; public Pair(K obj1, L obj2){this.a = obj1; this.b = obj2;} //... } I want to associate a ...
3
votes
1answer
1k views

Divide the world map into fixed sized blocks

I am developing an app where I need to divide the entire world map into fixed sized square blocks. For simplicity, think of it as a problem of dividing the google maps into a fixed sized block. I can ...
8
votes
4answers
14k views

What does mapping mean in programming?

I often hear things like: Mapping the classes Mapping the objects from the database Mapping the objects Mapping the elements of a list A mapper What does a mapper and the act of mapping something ...
-3
votes
2answers
704 views

Integer Map Algorithm [closed]

For my project, I need to map integers so that inputting int X will output int Y where both X and Y are defined during runtime. I've used Dictionary<int,int> in .NET but its memory use is too ...
-3
votes
1answer
274 views

DDD - map or object [closed]

What is correct by DDD - should I create map of two objects eg Map or should i use more meaningfull object that will contain this pair MoreMeaningfullName{Obj1, Obj2} ? If using first approach, I don'...
18
votes
4answers
11k views

“Use map instead of class to represent data” -Rich Hickey

In this video by Rich Hickey, the Clojure creator, he advises to use map to represent data instead of using a class to represent it, as done in Java. I don't understand how it can be better, since how ...
2
votes
1answer
526 views

Determine exact coordinates for a map image?

My brother suggested that I should write a web app that lets students create and print blank maps. A blank map is a map that contains country borders, waters etc. but no text labels. The first use ...
1
vote
4answers
20k views

Adding values to HashMap

I want to add values to a HashMap, which would be used by methods in the same class. I have two solutions: Adding all the values with static When the first method is called, add the values Solution #...
1
vote
1answer
82 views

Reduce Operations on Distributed Databases

I would like to ask you about optimizing reduce operations (e.g. count) on multiple databases. Let's say there is a user table that is stored in various countries and sharding is made based on the ...
1
vote
1answer
143 views

storing map template in database

I am working on an application that displays choropleth maps. These maps are of all different types, some display state by county, country by state/province, or world by country. How should I ...
2
votes
1answer
232 views

How to find out if a tile is being covered by a polygon?

Given a (intersecting) polygon, I'd like find out which tiles are being covered by the polygon. Example: Details: Tiles are square, 1 unit wide/high The grid begins in (0,0) The corners of the ...
2
votes
2answers
3k views

Mapping a list of optional values to an optional list of values

I have encountered the following pattern while programming in Haskell (but the pattern could occur in any language supporting lists, option types, and mapping of a function over a list). I have types ...
-3
votes
1answer
25k views

Why does HashMap allow only one null key? [closed]

A HashMap allows only one null key. Is it because it allows only unique keys? Or is there another reason?
3
votes
2answers
5k views

How do I initialize a Scala map with more than 4 initial elements in Java?

For 4 or fewer elements, something like this works (or at least compiles): import scala.collection.immutable.Map; Map<String,String> HAI_MAP = new Map4<>("Hello", "World", ...
1
vote
1answer
117 views

how to map controllers , models, and views as a todo list

Before starting on a current project I was wondering if there is a terminology for what I am planning on doing? Basically what I want to do is map out every object in layers such as all the ...
2
votes
2answers
8k views

Dataset with coordinates of borders of countries [closed]

I am creating an application that visually displays world regions, e.g. to place markers within an administrative region. Does a dataset exist with geometrical or geographical (long/lat) descriptions ...
20
votes
6answers
8k views

Map of functions vs switch statement

I'm working on a project that processes requests, and there are two components to the request: the command and the parameters. The handler for each command is very simple (< 10 lines, often < 5)....
4
votes
2answers
2k views

How can “hash functions” be used to implement hash maps at all?

My understandment is that hash maps allow us to link, say, a string, to certain memory location. But if every string were to be linked to a unique place in memory it would need a huge block of empty ...
2
votes
2answers
152 views

What can I do in order to inform users of potential errors in my software in order to minimize liability?

I'm an independent software developer that's spent the last few months creating software for viewing and searching map data. The software has some navigation functionality as well (mapping, directions,...
2
votes
2answers
198 views

Best approach for saving highlighted areas on geographical map

I am designing an application that allow users to highlight areas of a geographical map using a tool that is like brush or a pen. The tool basically draw a circle with a single click and continue ...
6
votes
1answer
189 views

Multi-platform Map Application

I'm working on a web project (PHP, jQuery) which currently using Google Maps powering up the map functionality of the application, however we need to make it multi-platform like you can go to the ...
3
votes
1answer
273 views

For csv database extracts, how do map keys not create a dependency?

A lot of my work is done with .csv extracts (reports) from databases. As I have been programming in Clojure, I've received comments that relying on vector indexes creates dependencies. I understand ...
1
vote
1answer
805 views

Countour Mapping API

I have done some searching on Google, but haven't come up with much as of yet. I am wanting to take a set of point data, which I had previously been using to create weighted points for a heat map ...
2
votes
2answers
2k views

Google Maps-based desktop application [closed]

I want to build a desktop application which has google maps embedded to it. This app should have a thread to read coordinate data online a usb microphone to use. This application will move the google ...