Phương thức put () chỉ đơn giản là đặt các phím và các giá trị trong ArrayLists tương ứng. Trong main (), SlowMap được tải và sau đó in để cho thấy rằng nó Trong trường hợp bình thường, bạn sẽ muốn cung cấp một giá trị mặc định hợp lý. Trong thực tế, một thành ngữ điển hình là thấy trong các dòng: | while new MPair return entries public String toString StringBuffer s new StringBuffer Iterator ki vi while if return public static void main String args SlowMap m new SlowMap m 15 m new String ALGERIA Algiers ANGOLA Luanda BENIN Porto-Novo BOTSWANA Gaberone BURKINA FASO Ouagadougou BURUNDI Bujumbura CAMEROON Yaounde CAPE VERDE Praia CENTRAL AFRICAN REPUBLIC Bangui CHAD N djamena COMOROS Moroni CONGO BraZzaville DJIBOUTI Dijibouti EGYPT Cairo EQUATORIAL GUINEA Malabo . The put method simply places the keys and values in corresponding ArrayLists. In main a SlowMap is loaded and then printed to show that it works. Feedback This shows that it s not that hard to produce a new type of Map. But as the name suggests a SlowMap isn t very fast so you probably wouldn t use it if you had an alternative available. The problem is in the lookup of the key there is no order so a simple linear search is used which is the slowest way to look something up. Feedback The whole point of hashing is speed hashing allows the lookup to happen quickly. Since the bottleneck is in the speed of the key lookup one of the Chapter 11 Collections of Objects 565 solutions to the problem could be by keeping the keys sorted and then using to perform the lookup an exercise at the end of this chapter will walk you through this process . Feedback Hashing goes further by saying that all you want to do is to store the key somewhere so that it can be quickly found. As you ve seen in this chapter the fastest structure in which to store a group of elements is an array so that will be used for representing the key information note carefully that I said key information and not the key itself . Also seen in this chapter was the fact that an array once allocated cannot be