EnumMap and enummap

Source: Internet
Author: User

EnumMap and enummap

First: directly use

EnumMap em = new EnumMap (C. class); em. put (C. UK, "spring flowers bloom"); em. put (C. US, 233); System. out. println (em );

This EnumMap allows you to insert various types of values. Because of the java automatic packaging mechanism, you can even insert integers and other basic types.

At The same time, the eclipse prompt: Type safety: The method put (Enum, Object) belongs to the raw type EnumMap. References to generic type EnumMap <K, V> shocould be parameterized

Type 2: Inherit the EnumMap class

1 import java.util.EnumMap;2 3 public class Phons extends EnumMap<C, Phon> {4     public Phons() {5         super(C.class);6     }7 }

If an irrelevant type is inserted into it. Compilation error:

Exception in thread "main" java. lang. Error: Unresolved compilation problem:
The method put (C, Phon) in the type EnumMap <C, Phon> is not applicable for the arguments (C, int)

This method avoids type security issues.


There are two loan methods. Which one is more cost-effective? Are there any formulas for mutual conversion between the two methods?

If the landlord's funds are not reinvested or used for turnover, it is undoubtedly a bank loan cost-effectiveness. However, if the funds are reinvested, it may not be a bank loan combination. The first type of repayment principal will be halved in half a year, while the second type of principal will not change temporarily. In terms of capital utilization efficiency, it must be the second type of high. Whether it is cost-effective depends on what your money is.
The comparison on the first floor is not detailed enough. For example, if 0.12 million of the principal does not move and 0.12 million of the principal is reduced month by month, even if the excess funds are regularly stored in the bank for three or six months, there are also 2.6%-2.8% annualized fixed-time deposits. The real measurement must be accurate. It depends on what you do not need to return the loan principal for the time being and what the rate of return is, so that you can know how your money can be borrowed.

Comparison of the C language Bubble Method

I think they are different:
1. The first one. The exchange always happens between two adjacent numbers. Find a non-largest one in the first loop. It's next big ......
2. the second is that the exchange does not necessarily occur between two adjacent numbers. The idea is that each position is compared with the number at the position I, exchange with the number on I. I think this method is more like a comparative sorting method, and it is a troublesome comparison sorting method. For a normal comparison, you only need to record it and switch it for the last time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.