package cn.qmai.study.java.demo1;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 复杂数组
 *
 * @author 宋欢
 */
public class ComplexArr {
    /**
     * Map初始容量
     */
    private static final int MAP_INITIAL_CAPACITY = 4;

    public static void main(String[] args) {
        Map<Object, Object> book1 = new HashMap<>(MAP_INITIAL_CAPACITY);
        book1.put(null, 1);
        book1.put("name", "PHP核心技术与最佳实践");

        Map<Object, Object> book2 = new HashMap<>(MAP_INITIAL_CAPACITY);
        book2.put(null, "深入PHP：面向对象、模式与实践");
        book2.put("price", 100);

        Map<Object, Object> book3 = new HashMap<>(MAP_INITIAL_CAPACITY);
        book3.put(null, 3);
        book3.put("name", "PHP7内核剖析");
        book3.put(null, 55.5);

        List<Object> book4 = new ArrayList<>();
        book4.add("PHP安全之道");
        book4.add(62);

        List<Object> book_3_4 = new ArrayList<>();
        book_3_4.add(book3);
        book_3_4.add(book4);

        Map<Object, Object> books = new HashMap<>(MAP_INITIAL_CAPACITY);
        books.put(1, book1);
        books.put("深入PHP", book2);
        books.put(null, book_3_4);

        System.out.println(books);
    }

}
