Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "=>" mean in import in scala?

I am new to scala. I am looking through some code and came up with a code that imports com.infinite.usermanagement.controllers.{ SecurityService => BaseSecurityService } package. I was wondering what does => sign means in an import.

like image 515
odbhut.shei.chhele Avatar asked Jul 27 '15 12:07

odbhut.shei.chhele


Video Answer


1 Answers

This line means you import the class SecurityService and rename it to BaseSecurityService. You can use this to prevent name conflicts, etc. You can use this class by using BaseSecurityService instead of the original class name.

A very common example is the following (to prevent mixing up Scala and Java classes):

import java.util.{Map => JMap, List => JList}
like image 105
Peanut Avatar answered Sep 28 '22 03:09

Peanut



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!