list 文件中行的顺序重要吗?
有人试图说服我,当 list 文件从
Manifest-Version: 1.0
Class-Path: xxx.jar
Main-Class: com.something
到
Manifest-Version: 1.0
Main-Class: com.something
Class-Path: xxx.jar
(Main-Class 和 Class-Path 行颠倒了。)
最佳答案
不,这两行的顺序无关紧要。
这是来自 the documentation 的引述:
...
Versions:
Manifest-Version and Signature-Version must be first, and in exactly that case (so that they can be recognized easily as magic strings). Other than that, the order of attributes within a main section is not significant.
Ordering:
The order of individual manifest entries is not significant.
...
在内部, list 由 HashMap
表示,它是一种无序的数据结构。如果您想仔细查看,这里是源代码 java.util.jar.Manifest
。
关于java - Java list 文件中行的顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7145790/