Reuse of Map.Entry
Hi,
I'm writing some Map implementations and warppers and i have specific question.
Is Map.Entry reusable after calling next iterator.next().
Questionable code. Is this valid.
Map.Entry first = null;
for( Iterator i = myMap.entrySet().iterator()) {
Map.Entry entry1 = (Map.Entry)i.next();
if( first == null) first = entry1;
// do something with entry
// do something with first entry <<<<Does do something with "first" is valid operation,
or entrySet can return the same object for each entry but with
some different internal data.
This is performance question, since in my Map implementation there is
nothing similar to Map.Entry, so I must create new instance
of wrapper for each iteration.
I'd like to return always one instance (shared amont Iterator returned by Map.entrySet().iterator()) pointing to different "real" data.
Thanks.
This and many more examples, esp. with wrappers or
or so called "views" shows weaknes of java.util contracts.I think it should be written in documentation of Map interface.It can be found in the javadocs for the Map.Entry interface:
A map entry (key-value pair). The Map.entrySet method returns a collection-view
of the map, whose elements are of this class. The only way to obtain a reference
to a map entry is from the iterator of this collection-view. These Map.Entry objects
are valid only for the duration of the iteration; more formally, the behavior of a
map entry is undefined if the backing map has been modified after the entry was
returned by the iterator, except through the iterator's own remove operation, or
through the setValue operation on a map entry returned by the iterator.
kind regards,
Jos
Similar Messages
-
What is the diffrence between map and map.entry in core java
what is the diffrence between map and map.entry in core java . where it will be use ful. any one give one example plz.
A Map contains Map.Entry's
e.g.
Map map = new LinkedHashMap(8);
map.put(new Integer(1), "one");
map.put(new Integer(2), "two");
final Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
System.out.println("key=" + entry.getKey() + ", value=" + entry.getValue());
} -
Reuse of MAP in Import Manager
I am trying to reuse a MAP created to load KNA1 table in Import Manager in the same server. The Source file name and file type (.xls) is the same, as well as the original worksheet name. While the Import Manager is matching records, it is abending w/ following msg - Error sig:
AppName: importmanager.exe; Appver 1.0.0.1; ModName: importmanager.exe; ModVer: 1.0.0.1; Offset: 004e9c90
ThanksSure, this is possible. Remember that map/syn files are useful when you know in advance nothing has changed, that is, when automating the process (via batch/server processing).
One example might be if MDM is expecting numeric value, whereas in the past you used a text value. You might not be changing the source data, but you have made the MDM Repository more restricted.
Perhaps you should review which changes have taken place, something might be escaping your sigh
I hope this helps
Regards
Alejandro -
Missing "Mapping entry" issue in tranferring Cust/Vendor Master Data
Hi All,
We are doing a version upgrade in one of our client for SCM APO (SCM 7.0 SPS 8). We are getting an error while transferring customer/ vendor master data (either in foreground or background) that "No location XXXXXXXX exists for mapping entry XXXXXXX of category 1011 (1010 in case of customer).
Please provide your valuable help to resolve this issue.
Thanks.Dear Ravi.
Please use the report ZMATMAP_REORG provided in note 859650 to remove the inconsistencies between /SAPAPO/LOCMAP and /SAPAPO/LOC.
The number of entries in these both tables should be the same.
I am not aware of your SCM Release, but it is also relevant for release 4.1, despite the info in the note.Please copy the report in your system and execute it firstly in the test mode.
I hope this helps you!
Let me know the outcome of the issue.
Thank you!
Will -
Why do we use Map.Entry ?
I have this example of mine where am able to do everything using the entrySet() method, hence I dont see any use of Map.Entry.
public class HashMapDemo {
public static void main ( String args [])
HashMap hm = new HashMap();
hm.put("Rohit", new Double(3434.34));
hm.put("Rohita", new Double(3435.34));
hm.put("Mohit", new Double(123.22));
hm.put("Ashish", new Double(1200.34));
hm.put("Khariwal", new Double(99.34));
hm.put("Pankaj", new Double(-19.34));
Set set = hm.entrySet();
System.out.println("the value of set is " + set);
Iterator i = set.iterator();
while (i.hasNext())
System.out.println(i.next());
}jose_an wrote:
What i exactly meant to ask is what's the exact need of Map.Entry inner class in HashMap.
If we can use an iterator then whats the need for Map.EntryYou can iterate over the keys, if all you want is the keys.
You can iterate over the values, if all you want is the values.
You can iterate over the key/value pairs, if you want to process all the pairs.
Map.Entry is not strictly necessary--or at least doesn't need to be made public--but it can be useful. Sure, you could just use keySet() instead of entrySet() and then use each key to get the corresponding value, but if you want to work with both together, it can make for clearer code to have a single object that represents that pairing.
Also, when iterating over a map's key/value pairs, it could be somewhat faster to just iterate over the entrySet, rather than iterating over the keys and then calling get() each time. In most cases, the difference should be negligible, but depending on the map implementation and usage profile, it could be significant. -
Compile error import java.util.map$entry
Hi,
I am trying to compile code which imports the following package
import java.util.Map$Entry.
The error thrown up is : cant resolve symbol Map$Entry. Why is there a $ in the package import path and is there some configuration required to compile the file.
I am not allowed to change the code. Does anyone have an idea on how this problem can be solved.
Thanks and regards
Kumar VellalBtw java docs for the interface are available at:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.Entry.html
Changing the import should probably help compile the code, but without changing the import .. need to check. This is just from what i remember now. Lets see if anyone else comments on this. -
Map.Entry not supported in queries?
Hi,
I tried to run the following JDO query:
Query query = pm.newQuery(SomeClass.class);
query.setFilter("someMap.contains(entry) && entry.key == value");
query.setOrdering("entry.value ascending");
query.declareVariables("java.util.Map.Entry entry");
query.declareParameters("String value");
Object result = query.execute(someValue);
where someMap is an attribute of SomeClass which is of type java.util.Map
but I received the following exception:
kodo.util.UserException: The type "java.util.Map.Entry" as used in the
variable/parameter declarations could not be found in the imports.
at kodo.query.AbstractQuery.bindClasses(AbstractQuery.java:1507)
at kodo.query.AbstractQuery.bindVariables(AbstractQuery.java:1480)
at kodo.query.AbstractQuery.internalCompile(AbstractQuery.java:501)
at kodo.query.AbstractQuery.compileForParse(AbstractQuery.java:456)
at kodo.query.AbstractQuery.getParameterTypes(AbstractQuery.java:1198)
I've also tried specify Map.Entry as "java.util.Map$Entry" and it also
doesn't work. Does it mean that Map.Entry or inner classes are not
supported in queries?
Someone please help,
StephenStephen-
Map.Entry is not supported in queries (although you could conveivably
write a query extension that supports it).
Note that it does look like you can you the supported filter
"someMap.containsKey(keyParam)" (which would do the same thing as your
query "someMap.contains(entry) && entry.key == value").
In article <cc5jbq$c49$[email protected]>, Stephen Leung wrote:
Hi,
I tried to run the following JDO query:
Query query = pm.newQuery(SomeClass.class);
query.setFilter("someMap.contains(entry) && entry.key == value");
query.setOrdering("entry.value ascending");
query.declareVariables("java.util.Map.Entry entry");
query.declareParameters("String value");
Object result = query.execute(someValue);
where someMap is an attribute of SomeClass which is of type java.util.Map
but I received the following exception:
kodo.util.UserException: The type "java.util.Map.Entry" as used in the
variable/parameter declarations could not be found in the imports.
at kodo.query.AbstractQuery.bindClasses(AbstractQuery.java:1507)
at kodo.query.AbstractQuery.bindVariables(AbstractQuery.java:1480)
at kodo.query.AbstractQuery.internalCompile(AbstractQuery.java:501)
at kodo.query.AbstractQuery.compileForParse(AbstractQuery.java:456)
at kodo.query.AbstractQuery.getParameterTypes(AbstractQuery.java:1198)
I've also tried specify Map.Entry as "java.util.Map$Entry" and it also
doesn't work. Does it mean that Map.Entry or inner classes are not
supported in queries?
Someone please help,
Stephen
Marc Prud'hommeaux
SolarMetric Inc. -
Create GPP drive mapping entries programmatically
Can anyone provide any sample codes that creates drive mapping entries in group policy preference? I am not looking for script to create the GPO, I am looking for codes to create mapping entries inside it instead. I've been searching for MS document
but found nothing so far.
Specifically I am looking for codes that can create entries using item level targeting criteria as below:
- OS type
- session type (RDP vs local console)
- user group membership
Any pointer is appreciated.Also you can use.
$Network = New-Object -ComObject "Wscript.Network"
$Network.MapNetworkDrive("P:", "\\MyComputer\MyShare")
or
net use Z: \\server\share /persistent:yes
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/160d2ed5-6917-4593-a1ca-be3e8b808882/how-to-map-a-network-drive-persistent-using-powershell-v2?forum=ITCG
Regards~Biswajit
Disclaimer: This posting is provided & with no warranties or guarantees and confers no rights.
MCP 2003,MCSA 2003, MCSA:M 2003, CCNA, MCTS, Enterprise Admin
MY BLOG
Domain Controllers inventory-Quest Powershell
Generate Report for Bulk Servers-LastBootUpTime,SerialNumber,InstallDate
Generate a Report for installed Hotfix for Bulk Servers -
Hello,
I'm working with the Collection FrameWork
When you ask a Map for it's entrySet(), you get a Set of Map.Entry's.
public static interface Map.Entry
STATIC,
Why is this interface static???If it hadn't been static, you'd have to have an instance of Map to use the interface. Now you can simply implement Map.Entry.
Kind regards,
Levi -
Compile errors importing Map$Entry
Hi,
I trying to compile code written by my client which uses the following syntax
import java.util.Map$Entry.
This throws a compilation error :
cant resolve symbol class Map$Entry
package : java.util
The same compile at the client side works. Am i missing some configuration. Also why is the path defined as Map$Entry instead of Map.Entry.
any help would be greatly appreciated
thanks and regrads
Kumar VellalWhat you're client is trying to do is import a nested class. To do this you use the syntax:
import A.Enclosing.Nested;Now you can refer to the nested class without refering to the enclosing class (i.e Nested n = new Nested();)
However - Some compilers don't like this, and I don't like it. You shouldn't import nested classes directly like this. -
Iteration through a list of map entries
hi,
I am facing a situation in which i have to write a rule to iterate through a list of map entries within a map and again iterate for a given attribute through a map of attributes within the selected map entry.
Can anyone throw light on any function or expression in the XPRESS language in the Identity Manager to accomplish this.
thanx in advance,
yashuwyahHI,
I cant help you out with full code at this point. But do make use of the following to determine the equivalency between GenericObject and HashMap as shown below.
Basic Operations
� map.keySet() == genObj[*].name
� map.entrySet() == genObj[*]
� map.get(attribute) == genObj.attribute
� map.get(attribute1).get(attribute2).get(employeeNumber) ==
genObj. attribute1. attribute2.employeeNumber� if attribute1 indexes a list object in the preceding example ==
genObj. attribute1[attribute2].employeeNumber� Searches
� find the object with the attribute fullname = �John Smith� ==
genObj[fullname=John Smith]� get John Smith�s employeeNumber == genObj[fullname=John
Smith].employeeNumber� List Operations
� get the names of all permanent employees ==
genObj[employeeType=permanent].nameFor your requirements, I figure that you can iterate through the list in the beginning and assign the initial result to a <defvar>. Then use the reference of this to determine the required attributes next.
IC. -
public class ClasseTeste extends AbstractMap
/** Creates a new instance of ClasseTeste */
public ClasseTeste() {
public Set<Map.Entry<Object, Object>> entrySet() {
Thanks!public class ClasseTeste extends AbstractMap
/** Creates a new instance of ClasseTeste */
public ClasseTeste() {
public Set<Map.Entry<Object, Object>> entrySet() {
Thanks!Its a new feature of java 1.5 called generics.
here
Set<Map.Entry<Object, Object>> means this set will contain objects of type Map.Entry only.
Wid generics u can avoid casting n define generic types.
sudhir
http://www.jyog.com -
Crypto map entry is incomplete
Hi
This is my config below. The error i am recieving is crypto map entry is incomplete. Can someone please take a look and let me know. Thank you
ASA(config)# crypto map outside_map 1 match address outside_1_cryptomap
WARNING: The crypto map entry is incomplete!
ASA(config)# show run
: Saved
ASA Version 8.4(4)1
interface Ethernet0/0
switchport access vlan 2
interface Ethernet0/1
interface Ethernet0/2
interface Ethernet0/3
interface Ethernet0/4
interface Ethernet0/5
interface Ethernet0/6
interface Ethernet0/7
interface Vlan1
nameif inside
security-level 100
ip address 10.10.10.2 255.255.255.0
interface Vlan2
nameif outside
security-level 0
ip address dhcp setroute
ftp mode passive
object network obj_any
subnet 0.0.0.0 0.0.0.0
object network net-local
subnet 10.10.10.20 255.255.255.0
object network net-remote
subnet 10.10.3.0 255.255.255.0
access-list outside_1_cryptomap extended permit ip 10.10.10.20 255.255.255.0 10.
10.3.0 255.255.255.0
pager lines 24
logging asdm informational
mtu inside 1500
mtu outside 1500
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
nat (any,any) source static net-local net-local destination static net-remote ne
t-remote
object network obj_any
nat (inside,outside) dynamic interface
timeout xlate 3:00:00
timeout pat-xlate 0:00:30
timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
timeout tcp-proxy-reassembly 0:01:00
timeout floating-conn 0:00:00
dynamic-access-policy-record DfltAccessPolicy
user-identity default-domain LOCAL
http server enable
http 192.168.1.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart warmstart
crypto map outside_map 1 match address outside_1_cryptomap
crypto map outside_map 1 set pfs group1
crypto map outside_map 1 set peer 96.145.68.82
crypto map outside_map interface outside
crypto ikev1 enable outside
crypto ikev1 policy 10
authentication pre-share
encryption aes
hash sha
group 2
lifetime 86400
telnet timeout 5
ssh timeout 5
ssh key-exchange group dh-group1-sha1
console timeout 0
dhcpd auto_config outside
dhcpd address 10.10.10.22-10.10.10.231 inside
dhcpd enable inside
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
webvpn
tunnel-group 81.141.29.69 type ipsec-l2l
tunnel-group 81.141.29.69 ipsec-attributes
ikev1 pre-shared-key *****
class-map inspection_default
match default-inspection-traffic
policy-map type inspect dns preset_dns_map
parameters
message-length maximum client auto
message-length maximum 512
policy-map global_policy
class inspection_default
inspect dns preset_dns_map
inspect ftp
inspect h323 h225
inspect h323 ras
inspect rsh
inspect rtsp
inspect esmtp
inspect sqlnet
inspect skinny
inspect sunrpc
inspect xdmcp
inspect sip
inspect netbios
inspect tftp
inspect ip-options
service-policy global_policy global
prompt hostname context
no call-home reporting anonymous
Cryptochecksum:c2b7cdae5eb0961d822f634f2b36d3dc
: end
ASA(config)#Hi,
You lack a "transform-set" configuration from the "crypto map" line.
For example
Create the IKEv1 Transform set
crypto ipsec ikev1 transform-set AES esp-aes esp-sha-hmac
and
Use it in the VPN configuration
crypto map outside_map 1 set ikev1 transform-set AES
The values ofcourse depend on the your own preference
Hope this helps
- Jouni -
Rejecting IPSec tunnel: no matching crypto map entry for remote proxy
Hi!
I have already search for this but didn't get an exact answer I'm looking for so I try asking it again (if there is the same question).
I'm in process of migrating some VPN tunnels with from a Cisco router to an ASA, everything will keep the same but just the peering IP address. However, some of the tunnel was being torn down since it request for a proxy doesn't match the one configured on our side. And the remote peer said there is no such issue on the previous platform, but now they need to reset the tunnel from time to time.
Apr 18 2013 07:29:10 asa002 : %ASA-3-713061: Group = 192.168.1.226, IP = 192.168.1.226, Rejecting IPSec tunnel: no matching crypto map entry for remote proxy 192.168.1.226/255.255.255.255/0/0 local proxy 10.10.9.81/255.255.255.255/0/0 on interface outside
Apr 18 2013 07:29:10 asa002 : %ASA-3-713902: Group = 192.168.1.226, IP = 192.168.1.226, QM FSM error (P2 struct &0x745e9150, mess id 0x8d7ad777)!
Apr 18 2013 07:29:10 asa002 : %ASA-3-713902: Group = 192.168.1.226, IP = 192.168.1.226, Removing peer from correlator table failed, no match!
The remote peer said they did not change the proxy id on their side so it is possibly the old platform will just not setting up the SA without torn down the tunnel while the ASA on the new platform will torn down if there is any mismatch.
Anyway I have requested the remote side to remove those unmatched entried to avoid the tunnel being torn down, but if there any configuration that is related to this issue? i.e. Just bring up the SA with matched addresses and ignore others, instead of torn down the tunnel.
Thanks!!
//CodyAre you trying to send traffic destined towards the internet from 172.16.0.0/20 via this ASA as well? why? are you inspecting those traffic before being sent out to the internet?
If so, this end also needs to be configured with "any" as well --> crypto ACL needs to mirror image.
access-list outside_1_cryptomap extended permit ip any 172.16.0.0 255.255.240.0
Then you also need NAT on the outside interface, otherwise, traffic from 172.16.0.0/20 is not PATed to a public IP, and won't be able to reach the internet:
nat (outside) 1 172.16.0.0 255.255.240.0 -
Hi,
I have read a problem where the VPN between an ISP and ourselves started dropping sessions. I have rebuilt the crypto map and tried to dig deeper into my config and some basic troubleshooting while I await the ISP to respond.
Any ideas?
Thanks Steve
https://supportforums.cisco.com/thread/255085
http://www.cisco.com/en/US/products/ps6120/products_tech_note09186a00807e0aca.shtml#solution10
5 Jun 13 15:46:25 713904 IP = 209.183.xxx.xxx, Received encrypted packet with no matching SA, dropping
4 Jun 13 15:46:25 113019 Group = 209.183.xxx.xxx, Username = 209.183.xxx.xxx, IP = 209.183.xxx.xxx, Session disconnected. Session Type: IKE, Duration: 0h:00m:00s, Bytes xmt: 0, Bytes rcv: 0, Reason: crypto map policy not found
3 Jun 13 15:46:25 713902 Group = 209.183.xxx.xxx, IP = 209.183.xxx.xxx, Removing peer from correlator table failed, no match!
3 Jun 13 15:46:25 713902 Group = 209.183.xxx.xxx, IP = 209.183.xxx.xxx, QM FSM error (P2 struct &0xda90f540, mess id 0x76c09eb7)!
3 Jun 13 15:46:25 713061 Group = 209.183.xxx.xxx, IP = 209.183.xxx.xxx, Rejecting IPSec tunnel: no matching crypto map entry for remote proxy 172.16.0.0/255.255.240.0/0/0 local proxy 0.0.0.0/0.0.0.0/0/0 on interface outside
5 Jun 13 15:46:25 713119 Group = 209.183.xxx.xxx, IP = 209.183.xxx.xxx, PHASE 1 COMPLETED
6 Jun 13 15:46:25 113009 AAA retrieved default group policy (DfltGrpPolicy) for user = 209.183.xxx.xxx
6 Jun 13 15:46:25 713172 Group = 209.183.xxx.xxx, IP = 209.183.xxx.xxx, Automatic NAT Detection Status: Remote end is NOT behind a NAT device This end is NOT behind a NAT deviceAre you trying to send traffic destined towards the internet from 172.16.0.0/20 via this ASA as well? why? are you inspecting those traffic before being sent out to the internet?
If so, this end also needs to be configured with "any" as well --> crypto ACL needs to mirror image.
access-list outside_1_cryptomap extended permit ip any 172.16.0.0 255.255.240.0
Then you also need NAT on the outside interface, otherwise, traffic from 172.16.0.0/20 is not PATed to a public IP, and won't be able to reach the internet:
nat (outside) 1 172.16.0.0 255.255.240.0
Maybe you are looking for
-
Scan with HP Photosmart Premium using Mac OSX 10.9.2
I need to scan a document (must be in pdf) and email it to my son. I have an HP Photosmart Premium printer and a MacBook Pro running OSX 10.9.2. The printer says try starting scan from computer when I choose computer from printer screen. I could u
-
The new iTunes update mutes the volume when movies are played in full screen. Help?
Yep. After installing 11.1.3, the audio of a movie in iTunes when you switch to full screen plays for a fraction of a second and then goes off. I can play other things in the background (Pandora, ANYTHING with volume) and the volume for those is fi
-
Merge Still Photos with Video Clips?
I have an iMovie project containing only video clips in the timeline, arranged by capture date/time. I also have an iPhoto file containing still photos of similar material. How can I import all of the iPhoto stills into the iMovie project such that t
-
What methods are available to migrate Data from MS SQL to Oracle DB 11g.
Hi, Need to know the No of ways/ Techniques via we can Migrate data from MS SQL Server to Oracle DB 11g. Thanks , NL
-
List - Display Name with Presence (1st column) Display User ID (2nd Column)
I have a simple list and one column titled Member and it is set as a Person field. My goal is to also have the corresponding Member.ID (ex 9012) also available as a second column so that when a user enters a name, it will auto populate the ID column.