Time complexity of Map.clear in Scala

When called on a Map, is the time complexity of clear O(1) or O(n) on the size of the map?


In the case of immutable maps don't have clear since they are immutable but they do have empty which returns a new empty map of that type. Since it is just an object creation it is O(1). Mutable maps however are O(n) where n is based on the underlying data structure since they have to clear out that data structure. For the typical mutable HashMap this will be a table. The table size will be between 0.75 and 1.5 the maximum size the Map has been in the past.

Need Your Help

Child state loads parent state templateUrl in nested routes of UI-Router

javascript angularjs angular-ui-router templating

I'm using UI-Router module for routing. I have 2 states that router should match the urls with them according to nested routes laws :

Date selection with separate boxes for day, month and year

date jsf-2 drop-down-menu custom-component

I'm making a Java EE + EJB + JSF web app and I'd like to have 3 select boxes for date of birth(1 for day, 1 for month and 1 for year) in my registration form just like on Facebook.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.