第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

工具類在哪找呢

跟著課程學(xué)到很多,對(duì)大數(shù)據(jù)有個(gè)系統(tǒng)的了解,寫代碼的時(shí)候沒有找到mapUtils 和 DateUtils, 麻煩可以提供下mapUtils 和 DateUtils嗎 ?

正在回答

2 回答

DateUtils代碼:


package test.top10;


import java.text.SimpleDateFormat;

import java.util.Date;


/**

?* 日期工具類

?*/

public class DateUtils {

? ? private static SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");

? ? private static SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");


? ? /**

? ? ?* 轉(zhuǎn)換日期格式

? ? ?* 從yyyyMMdd轉(zhuǎn)換為yyyy-MM-dd

? ? ?* @param dt

? ? ?* @return

? ? ?*/

? ? public static String transDataFormat(String dt){

? ? ? ? String res = "1970-01-01";

? ? ? ? try {

? ? ? ? ? ? Date date = sdf1.parse(dt);

? ? ? ? ? ? res = sdf2.format(date);

? ? ? ? }catch (Exception e){

? ? ? ? ? ? System.out.println("日期轉(zhuǎn)換失?。?+dt);

? ? ? ? }

? ? ? ? return res;

? ? }

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

MapUtils代碼:

package test.top10;


import java.util.*;


/**

?* Map工具類

?*/

public class MapUtils {


? ? /**

? ? ?* 根據(jù)Map的value值降序排序

? ? ?* @param map

? ? ?* @param <K>

? ? ?* @param <V>

? ? ?* @return

? ? ?*/

? ? public static <K, V extends Comparable<? super V>> Map<K, V> sortValue(Map<K, V> map) {

? ? ? ? List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());

? ? ? ? Collections.sort(list, new Comparator<Map.Entry<K, V>>() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2) {

? ? ? ? ? ? ? ? int compare = (o1.getValue()).compareTo(o2.getValue());

? ? ? ? ? ? ? ? return -compare;

? ? ? ? ? ? }

? ? ? ? });


? ? ? ? Map<K, V> returnMap = new LinkedHashMap<K, V>();

? ? ? ? for (Map.Entry<K, V> entry : list) {

? ? ? ? ? ? returnMap.put(entry.getKey(), entry.getValue());

? ? ? ? }

? ? ? ? return returnMap;

? ? }

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

工具類在哪找呢

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)