android“type.ordinal()” 如何理解?



public static Set<String> getAllTitles(Type type) {
        Set<String> result = new LinkedHashSet<>(sOnline[type.ordinal()].keySet());
        result.addAll(sLocal[type.ordinal()].keySet());
        return result;
    }




public enum Type {
        INSTALLER(R.string.install_update, R.string.framework_install, R.string.framework_install_recovery),
        UNINSTALLER(R.string.uninstall, R.string.uninstall, R.string.framework_uninstall_recovery);

        public final int title;
        public final int text_flash;
        public final int text_flash_recovery;

        Type(@StringRes int title, @StringRes int text_flash, @StringRes int text_flash_recovery) {
            this.title = title;
            this.text_flash = text_flash;
            this.text_flash_recovery = text_flash_recovery;
        }
阅读 1.2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题