class VersionSortUtil {
    public static List<String> assembleVersionList(List<InstanceEntity> instanceEntityList, VersionSortType versionSortType) {<FILL_FUNCTION_BODY>}

    public static List<String> getVersionList(List<VersionSortEntity> versionSortEntityList, VersionSortType versionSortType) {
        List<String> versionList = new ArrayList<String>();

        Collections.sort(versionSortEntityList, new Comparator<VersionSortEntity>() {
            public int compare(VersionSortEntity versionSortEntity1, VersionSortEntity versionSortEntity2) {
                if (versionSortType == VersionSortType.VERSION) {
                    String version1 = versionSortEntity1.getVersion();
                    String version2 = versionSortEntity2.getVersion();

                    return version1.compareTo(version2);
                } else {
                    String serviceUUId1 = versionSortEntity1.getServiceUUId();
                    String serviceUUId2 = versionSortEntity2.getServiceUUId();

                    return serviceUUId1.compareTo(serviceUUId2);
                }
            }
        });

        for (VersionSortEntity versionSortEntity : versionSortEntityList) {
            String version = versionSortEntity.getVersion();
            if (!versionList.contains(version)) {
                versionList.add(version);
            }
        }

        return versionList;
    }
}

        if (CollectionUtils.isEmpty(instanceEntityList)) {
            return null;
        }

        List<VersionSortEntity> versionSortEntityList = new ArrayList<VersionSortEntity>();
        for (InstanceEntity instanceEntity : instanceEntityList) {
            String version = instanceEntity.getVersion();
            String serviceUUId = instanceEntity.getServiceUUId();

            VersionSortEntity versionSortEntity = new VersionSortEntity();
            versionSortEntity.setVersion(version);
            versionSortEntity.setServiceUUId(serviceUUId);

            versionSortEntityList.add(versionSortEntity);
        }

        List<String> versionList = VersionSortUtil.getVersionList(versionSortEntityList, versionSortType);

        // 当服务未接入本框架或者版本号未设置（表现出来的值为DiscoveryConstant.DEFAULT），被认为是老版本
        String defaultVersion = DiscoveryConstant.DEFAULT;
        if (versionList.contains(defaultVersion)) {
            versionList.remove(defaultVersion);
            versionList.add(0, defaultVersion);
        }

        return versionList;
    
<no_super_class>