This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun Long.toReadableDate( | |
format: String = "yyyy-MM-dd HH:mm", | |
locale: Locale = Locale.KOREA | |
): String { | |
return SimpleDateFormat(format, locale).format(Date(this)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sort collection with given order(list) | |
*/ | |
class SortingWithGivenOrder<T>( | |
private val selector: (T) -> String, | |
private val orders: List<String> | |
) : Comparator<T> { | |
constructor(selector: (T) -> String, vararg orders: String) : this(selector, orders.toList()) | |
private val ordersMap = HashMap<String, Int>().apply { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get current date with formatting | |
SimpleDateFormat("yyyyMMdd", Locale.KOREA).format(Calendar.getInstance().time) |