This file contains 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
import java.util.regex.Pattern; | |
public class PasswordUtil { | |
private static String MsgLen8 = "String Must be 8 characters long"; | |
private static String MsgUpper = "Must contain at least one upper case letter"; | |
private static String MsgLower = "Must contain at least one lower case letter"; | |
private static String MsgDigit = "Must contain at least one digit"; | |
private static String MsgSp = "Must contain at least one special character from this list: !@#$%^&*()+-.,\"'(){}[]:;?/\\"; | |
private static Pattern pattern = Pattern.compile("^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()+=])(?=\\\\S+$).{4,}$"); |
This file contains 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
import android.app.AlertDialog; | |
import android.app.Dialog; | |
import android.content.ContentResolver; | |
import android.content.Context; | |
import android.content.res.ColorStateList; | |
import android.database.Cursor; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.graphics.Color; | |
import android.graphics.Matrix; |
This file contains 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
abstract class EndlessRecyclerOnScrollListener( | |
private val threshHold: Int = QUERY_PER_PAGE | |
) : RecyclerView.OnScrollListener() { | |
var isError = false | |
var isLoading = false | |
var isLastPage = false | |
var isScrolling = false | |
private var firstVisibleItem: Int = 0 | |
private var visibleItemCount: Int = 0 |
This file contains 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
Below are the Big O performance of common functions of different Java Collections. | |
List | Add | Remove | Get | Contains | Next | Data Structure | |
---------------------|------|--------|------|----------|------|--------------- | |
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array | |
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List | |
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array | |
This file contains 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
import kotlin.math.roundToInt | |
data class User( | |
val id: Int, | |
val name: String, | |
val webDev: Boolean = false, | |
val mobileDev: Boolean = false | |
) | |
data class Product(val name: String, val quantity: Int, val price: Double) |