map

How to Generate a Map in Java?

I trying to complete a RPG game for a project, but have no idea on how to make the game map. It doesn't need to be graphical, but the code for the whole map and each tile must be correct. So far, I thought about making a non-matricial map (as request by the professor) by using an ArrayList which contain all the linked tiles. public abs...

How to convert from from java.util.Map to a Scala Map

A Java API returns a java.util.Map<java.lang.String,java.lang.Boolean>;. I would like to put that into a Map[String,Boolean] So imagine we have: var scalaMap : Map[String,Boolean] = Map.empty val javaMap = new JavaClass().map() // Returns java.util.Map<java.lang.String,java.lang.Boolean> You can't do Map.empty ++ javaMap, because t...

C# refugee seeks a bit of Java collections help

I need to store key/value info in some type of collection. In C#, I'd define a dictionary like this: var entries = new Dictionary<string, int>(); entries.Add("Stop me", 11); entries.Add("Feed me", 12); entries.Add("Walk me", 13); Then I would access the values so: int value = entries["Stop me"]; How do I do this in Java? I've see...

<operator missing when iterating through c++ map

The following code does not want to compile. See the included error message. Code: #include <map> #include <vector> #include <iostream> class MapHolder { public: std::map<std::vector<std::string>,MapHolder> m_map; void walk_through_map() { std::map<std::vector<std::string>,MapHolder>::iterator it; for(it = m_map.beg...

Mapping API for Flex/Actionscript application?

I'm working on an application in Flex will utilize mapping features. I have experience with the Google Maps API in Flex, but it seems sort of limited to me (as compared to other APIs and the Javascript API). In particular, I'm interested in developing some clustering (grouping places together to prevent too many points from being on the ...

Using Map on a list of tuples and print it as flat string in Erlang

I have a list of tuples: X = [{"alpha","beta"},{"gamma","theta"}]. I want to print X as a flat string using, io_lib:format("~s", [X]) in the following format: [{"x":"alpha", "y":"beta"}, {"x":"gamma", "y":"theta"}] How do I achieve this? I started using Map to do transform the list. But I was not able to print it as a string...(ga...

Multi-valued hashtable in Java

Is it possible to have multiple values for the same key in a hash table? If not, can you suggest any such class or interface which could be used? ...

Dictionary class

is it possible to have multiple values for a single key in the java dictionary class?? ...

std::map and performance, intersecting sets

I'm intersecting some sets of numbers, and doing this by storing a count of each time I see a number in a map. I'm finding the performance be very slow. Details: - One of the sets has 150,000 numbers in it - The intersection of that set and another set takes about 300ms the first time, and about 5000ms the second time - I haven't don...

Updating a java map entry

Hi, I'm facing a problem that seems to have no straighforward solution. I'm using java.util.Map, and I want to update the value in a Key-Value pair. Right now, I'm doing it lik this: private Map<String,int> table = new HashMap<String,int>(); public void update(String key, int val) { if( !table.containsKey(key) ) return; Entry...

How to Get started with MapKit in iPhone

Hello all, I am new bie to objective c i have worked with uikit only now i want to create an application which will be showing the colleges around me and its distance in a tableview. So how to get started please suggest me. How do i embed map in iPhone. Thanks in advance. aamir ...

How to display map contents?

Hi I have a map map < string , list < string > > mapex ; list< string > li; how to display the above map items on the console. ...

How to iterate over a STL map full of strings in C++

I have the following issue related to iterating over an associative array of strings defined using std::map. -- snip -- class something { //... private: std::map<std::string, std::string> table; //... } In the constructor I populate table with pairs of string keys associated to string data. Somewhere else I have a method toS...

How can I combine the factory pattern with code flexibility

I am considering a factory function to create different classes in the same hierarchy. I understand that normally a factory is normally implemented as follows: Person* Person::Create(string type, ...) { // Student, Secretary and Professor are all derived classes of Person if ( type == "student" ) return new Student(...); if ...

Javascript "unspecified error" in Open Layers

I am getting this error when the map loads. The error is in the original, unmodified OpenLayers.js file on this line: return!!(document.namespaces); I have tried rewriting it to: return (typeof(document.namespaces) != 'undefined'); and it worked but then I get same "unspecified" errors on further referrals to document.namespaces: ...

Different address with map indexes vs content of map index

In the code below, why it is that when I take the address of a map index (which contains a list) and I take the address of the list itself, they both have different values. See the code below for clarification. #include <iostream> #include <list> #include <map> using namespace std; int main() { list<char> listA; //list of chars...

const std::map<boost::tuples::tuple, std::string> ?

// BOOST Includes #include <boost/assign.hpp> // Boost::Assign #include <boost/assign/list_of.hpp> // Boost::Assign::List_Of #include <boost/assign/std/map.hpp> // Boost::Assign::Map_List_Of #include <boost/tuple/tuple.hpp> // Boost::Tuples // STD Includes #include <map> #include <vector> #include <string> // Using namespaces us...

How to show a map in an Android mapactivity

I have attached a mapview to my layout and have a it showing a compass and my current location, the problem I have is that there is no street map shown in the view, so basically I just see the compass and my current location over a blank grid. ...

A std::map that keep track of the order of insertion?

I currently have a std::map<std::string,int> that stores an integer value to an unique string identifier, and I do look up with the string. It does mostly what I want, except for that it does not keep track of the insertion order. So when I iterate the the map to print out the values, they are sorted according to the string; but I want ...

Stuck on an interactive map.

SO, I am getting down to the wire on a deadline for an HTML/Flash hybrid interactive map, and it is not anywhere near finished. I keep getting close to solving each problem, only to discover more bugs. Most of them are quite obvious when you look at the work. I would like to at least squash the big bugs, so I am VERY appreciative of any ...