A unary operator is an operator that takes a single operand. However, in this case, the operand supplied to the operator effectively negates or renders the operator redundant. To put it simply, the operand supplied undoes whatever the unary operator accomplishes.
val b1 = true
val i = 0
val b2 = !(!b1) // Effectively same as `b1`
val j = ~(~i) // Effectively same as `i`
val b1 = true
val i = 0
val b2 = b1 // Effectively same as `b1`
val j = i // Effectively same as `i`