Found 1879 Articles for Mobile Development

What are the Service Primitives in Computer Network?

Bhanu Priya
Updated on 17-Mar-2022 07:56:26
A service is a set of primitives or we call it as operations where a user can invoke to access the service.The selective primitives tell the service to perform an action taken by peer nodes.The initiating node wants to establish a connection send CONNECT.Request − A node wants to do some work or a packet is being sent.The receiver accepts the request and CONNECT.Indication − A node is saying that it wants to set up a connection to it.The CONNECT. The node issuing the initial CONNECT. request finds out what happened via a CONNECT. Confirm primitive.Response is primitive to tell ... Read More

What are the differences between Thunderbolt and USB-C?

Bhanu Priya
Updated on 17-Mar-2022 07:15:44
Let us understand the concepts of Thunderbolt and USB-C before learning the differences between them.USB-CIt is an industry-standard connector for transmitting the two information and force on a solitary link. It includes another, littler connector shape that is reversible so it's simpler to connect. USB-C links can convey essentially more force, so they can be utilized to charge bigger gadgets like PCs.Most electronic gadgets, for example, PCs and other PC gear will incorporate at any rate one standard USB Type-A port, so any reasonable person would agree that USB connectors have been around for quite a while. Littler gadgets like ... Read More

What are the mobile device authentication actions?

Bhanu Priya
Updated on 17-Mar-2022 06:37:26
Mobile security, or cell phone security, has turned out to be progressively imperative in portable computing. Of specific concern is the security of individual and business data now put away on cell phones.ThreatsA cell phone client is presented to different dangers when they utilize their phone. The dangers can disturb the operation of the cell phone, and transmit or change client data. So applications must ensure security and honesty of the data they handle.In expansion, since some applications could themselves be malware, their usefulness and exercises ought to be constrained.For instance, limiting the application from getting to area data by ... Read More

How to find the number of repeated values in a Kotlin list?

Soumak De
Updated on 16-Mar-2022 14:35:30
In this article, we will see how to find the number of repeated values in a Kotlin list.Example – Finding Repeated Values Using groupingBy()The Kotlin library provides an inline function called groupingBy() which creates a grouping source from an array to be used later with one of the group-and-fold operations using the specified keySelector function to extract a key from each element.The function declaration of groupingBy() looks like this −inline fun Array.groupingBy(    crossinline keySelector: (T) -> K ): GroupingIn this example, we will create a list of values and implement groupingBy() in the list.fun main(args: Array) {   ... Read More

How to create a mutable list with repeating elements in Kotlin?

Soumak De
Updated on 16-Mar-2022 14:31:20
A Mutable List is an interface and generic collection of elements. Once a collection is declared as mutable, it becomes dynamic and we can modify its data as per requirement. A mutable list grows automatically in size as we insert new elements into it. The Mutable List inherits form the Generic class.Example – Creating a Mutable List in KotlinIn order to create a mutable list of repeating elements, we will be using Kotlin List(). By definition, it looks like this−inline fun List(    size: Int,    init: (index: Int) -> T ): ListAs we pass an initial default value, ... Read More

@Throws Annotation in Kotlin

Soumak De
Updated on 16-Mar-2022 14:24:34
The concept of exception in Kotlin is very much same as it is in Java. All the exceptions in Kotlin are the descendants of the Throwable class. @Throws annotation indicates what exceptions should be declared by a function when compiled to a JVM method.Example – Throwing exception using a methodIn this example, we will create a scenario where we will generate a logical arithmetic exception, but we will try to throw a different exception using the @throws annotation and a function call.import java.io.* import kotlin.jvm.Throws fun main(args: Array) {    val item=0    var result=0    try {   ... Read More

How to initialize List in Kotlin?

Soumak De
Updated on 16-Mar-2022 14:16:24
List denotes a List collection of generic data type. By , we understand that the List does not have any specific data type. Let's check how we can initialize such a collection in Kotlin.List can be of two types: immutable and mutable. We will see two different implementations of initializing List.Example – Initialize List ~ Immutable ListOnce a list is declared as Immutable, then it becomes read-only.fun main(args: Array) {    var myImmutableList = listOf(1, 2, 3)    // Convert array into mutableList    // Then, add elements into it.    myImmutableList.toMutableList().add(4)    // myImmutableList is not a ... Read More

How to work with Maps in Kotlin?

Soumak De
Updated on 16-Mar-2022 14:07:44
A Map is a collection where data is stored as a key-value pair and the corresponding keys have to be unique. A HashMap is a collection class based on MutableMap interface and it does that by implementing the MutableMap interface of HashTable.Kotlin provides four types of constructors to define and manipulate a HashMap.Example – Map Creation and Iteration in KotlinIn this example, we will be creating a Map called "subject" and we will be iterating through it.fun main(args: Array) {    // Declare HashMap    var subject : HashMap       = HashMap ();    // Assigning ... Read More

How to replace duplicate whitespaces in a String in Kotlin?

Soumak De
Updated on 16-Mar-2022 13:47:34
In order to remove extra whitespaces in a string, we will use the replace() function along with toRegex() function from the String class. To replace all the consecutive whitespaces with a single space " ", use the replace() function with the regular expression "\s+" which matches with one or more whitespace characters.Example – Removing extra whitespaces in KotlinTake a look at the following example −fun main(args: Array) {    var myString = "Removing ex tra spa ce from String"    println("Input String: " + myString)    // removing duplicate whitespace    println("Extra whitespaces removed: "    + myString.replace("\s+".toRegex(), " ... Read More

How to use Java's bitwise operators in Kotlin?

Soumak De
Updated on 16-Mar-2022 13:43:09
Kotlin provides a set of bitwise operators that we can use on integers. These operators can be applied only to Int and Long type variables. Here is the list of bitwise operations available in Kotlin −shl(bits) – Signed Shift leftshr(bits) – Signed shift rightushr(bits) – Unsigned shift rightand(bits) – Bitwise AND operatoror(bits) – Bitwise OR operatorxor(bits) – Bitwise XORinv() – Bitwise inversionKotlin does have functions for each of them.Example: Bitwise Operators in KotlinThe following example shows how you can implement the bitwise operators in Kotlin.import java.lang.* fun main(args: Array) {    val value = 5    println("Input value: " + ... Read More
Advertisements