Java The code is as follows :

package Test01;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; public class Test05 { // map convert to list
@SuppressWarnings({ "unchecked", "rawtypes" })
public static List mapTransitionList(Map map) {
List list = new ArrayList();
Iterator iter = map.entrySet().iterator(); // get map Of Iterator
while (iter.hasNext()) {
Entry entry = (Entry);
return list;
} @SuppressWarnings("unchecked")
public static void main(String[] args) {
Map map = new HashMap();
map.put("aaa", 11);
map.put("bbb", "22ss");
map.put("ccc", " Chinese characters ");
List list = mapTransitionList(map);
for (int i = 0; i < list.size(); i++) {
System.out.print(list.get(i) + " ");

After the code runs, the effect is as follows :

map convert to list More articles about

  1. ordinary map convert to Bean Tools for

    ordinary map convert to Bean Tools for package; import java.lang.reflect.Field; import java.lang.refl ...

  2. Map convert to byte[] Array

    hold Map convert to byte Array , Use  ByteArrayOutputStream and ObjectOutputStream Map<String,String> map = new HashMap ...

  3. Generic ( Two ) Wrapper utility class CommonUtils- Put one Map Convert to... Of the specified type javabean object

    1.commons-beanutils Use commons-beanutils-1.9.3.jar rely on commons-logging-1.2.jar Code 1: String className ...

  4. java list map Convert to a two-dimensional array

    /** * *@Title: ListToArray *@Description: list List into a two-dimensional array *@Author: Administrator *@Since: 2018 year 1 month 7 On the afternoon of Sunday ...

  5. Use fastjson take list、map convert to json, appear $ref

    This is the problem situation in the conversion ( map >> json ) Reference is through "$ref" To represent the quote describe "$ref":".." Last one ...

  6. js take map Convert to array

    /** * map Turn array . * * @param {Map}map * map object * @return Array */ Share.map2Ary = function(map) { var list = ...

  7. map convert to JSON Of 3 Methods format checks 1 json-lib <dependency> <groupId>net.sf.json-lib</groupId ...

  8. map convert to

    String json =new Gson().toJson(map); JsonObject jsonObject =new JsonParser().parse(json).getAsJsonOb ...

  9. java Add array to 、 object 、Map、List convert to JSON data

    If you want to put an array . object .Map.List convert to JSON data , Then we need some jar package : json-lib-2.4-jdk15.jar ezmorph-1.0.6.jar commons-logging.ja ...

Random recommendation

  1. hibernate Several states of an entity :

    hibernate Several states of an entity : In the life cycle of an entity , The entity mainly passes through the instantaneous (Transient), trusteeship (Attatched or Managed), free (Detached) And destroy (Removed) Four states . Instant ...

  2. C++ (P70—P96)

    1 Class members default to private models 2 Initialization of data members is not allowed within the declaration of a class 3 class , If you define... Outside of a class , Just add... Before the function type inline It's an inline function , If a function is defined within a class, it automatically becomes an inline member function ...

  3. wxpython 32 position ,python 64 Bit question

    In the installation Python Wxpython After module , When importing a package , Will prompt not support 64 Bit support , Need to install Pythons 32 position , Or forced , Use Python 32 Just run in mode Input... At the terminal : defaults w ...

  4. MVC5+ Routing characteristics

    MVC5+ Routing characteristics summary ASP.NET MVC 5 Support a new routing protocol , It's called routing characteristics . MVC5 It also supports the way of previously defined routes , You can use a mixture of these two ways to define a route in a project . Case study 1. Use Visua ...

  5. Common free Webservice Interface

    Express query interface  ip Query interface ...

  6. HTTP Basic knowledge of ( One )

    One . understand web And network foundation 1. Get the server resource by sending a request web Browsers and so on can be called clients (client) 2.HTTP:HyperText Transfer Protocol, Hypertext transfer protocol : be-all W ...

  7. javascript Learning one 、js A preliminary understanding of

    1.javascript An introduction to the : *javascript It's an object-based and event driven language , It is mainly used in clients . -- Based on the object :  ** A lot of objects are provided , You can use it directly . -- Event driven : ** html do ...

  8. mysql Conversion between bases

    1. Convert decimal to binary select bin(5); 2. Decimal to octal select oct(5); 3. Decimal to hexadecimal select hex(5); 4. Binary to decimal select ...

  9. Django Report errors : Submit form report error ---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.

    Django Report errors : Submit form report error ---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and ...

  10. Some experience of open source project ,Java Architecture must have several technical points

    About learning architecture , A few skills that must be learned 1. java Reflection technology      2. xml Document processing      3. properties Property file processing      4. Thread safety mechanism      5. annocation annotation ...