Differenece between remove method
Hi
what is difference between Collection.remove() and
iterator.remove() method.
Why can't we use Collection.remove() method to remove a element.
Pls clarify
Thanks in Advance.
ur's
malli
When you use Collection.remove() while using Iterator, you will get ConcurrentModificationException.
Similar Messages
-
Diference between remove method of EJBhome and ejbobject
Whats the differece between remove() gven in EJBObject and remove in EJBHome and when to use which.
TIAadditional info. if you would like to ponder more.
Handles
Handles are a serialisable reference to a particular EJB or EJB Home object. As they are serialisable they can be stored for later use in a persistent store such as a file or database.
We can get a handle to an EJB's Home object using the method getHandle(). This method is defined in the interface javax.ejb.EJBHome and is implemented by the container.
Once we have a home handle we can get a reference to the Home object using the method getEJBHome().
We can also get handles for EJB's using the method EJBObject.getHandle() (EJBObject is the interface that all EJB remote interfaces extend). Once we have a handle we can invoke getEJBObject() to re-create a valid remote reference to the bean (if it still exists) and cast this reference to the appropriate type. We can also get a reference to the EJB home from an EJBObject, and use this home reference to get an EJBMetaData object.
The EJB home object also defines the method remove(Handle h) to remove beans given their handle. For stateless session beans, invoking this method will make any further calls on the object referenced by the stub invalid. For stateful session beans, the reference also becomes invalid, with the corresponding loss of any session data maintained for the client using the handle.
Invoking remove for an entity bean will physically delete the beans fields from the resource manager (database) and make the remote reference invalid.
For entity beans handles are an alternative for the primary key, for session beans handles provide the only means of obtaining and storing a reference to the bean.
from: http://www.csse.monash.edu.au/courseware/cse3450/Lectures/Module7/module.html -
Differenece between T-codes XK01 & FK01
Hi all
Can any one tell me differenece between T-codes XK01 & FK01
Thanks
ShravanIn XK01 Vendor master record contains three sets of data
<b>General data:</b> It contains Vendors name, address, language, and phone numbers Tax numbers.Bank details etc
<b>Company code data:</b> It contains account control data like the number of the G/L reconciliation account for the vendor account.Payment methods and terms of payment set up with the vendor
<b>Purchase Organization data:</b>If you implement Materials Management (MM), you will need purchasing data. For more information on this, see the documentation for Materials Management. In Materials Management, vendors are represented as suppliers.
XK01 is used if MM is implemented.
In FK01 Vendor master record contains two sets of data
<b>General data:</b>This is data that applies to every company code and every purchasing organization in your company. The general area includes, for example, the vendors name, address, language, and telephone number.
<b>Company code data:</b>This is data that is specific to an individual company code.Company code data includes, for example, the reconciliation account number and payment terms. -
In BADi , How to pass the values between two Method
Hi Experts,
We have two methods in BADis. How to pass the value between two Methods. Can you guys explain me out with one example...
Thanks & Regards,
Sivakumar SHi Sivakumar!
Create a function group.
Define global data (there is a similiar menu point to jump to the top include).
Create one or two function modules, with which you can read and write the global data.
In your BADI methods you can access the global data with help of your function modules. It will stay in memory through the whole transaction.
Regards,
Christian -
What is the different between payment methods Wire and EFT
Hi All
can anybody tell me What is the different between payment methods Wire and EFT ?
Regards ;WIRE:
Wire is transfer of amount due directly to the supplier's bank it is an electronic transfer of funds
This mode of payment is used for international suppliers.
It can be paid in foreign currency or USD.
Wire payments are same day payments.
EFT:
EFT ensures funds transfer from one bank account to another using electronic links.
Can be used to make payments into domestic banks (within US) in USD only.
It is faster than check payments.
Hope this helps. -
Remove method: push in the right direction
Hello everybody. I am new to java and programming all together ( i have been programming for about 3 weeks or so). I am sorry if the question is simple. I seem to be having a problem with remove function.
Basically I have class Task(which has an ID, brief description, dueDate etc...). I also have a task TaskList as well as a class Date . The taskList has attributes an array of type Task with a length of 10. It also has methods to add, remove tasks as well as display the arrays contents. The remove method is what is causing me problems.
My general thinking was to find the arraycell containing the reference that points to the taskId that is to be removed. Afterwards I wanted to assign a null value to the cell containing the task to be removed. Then i would begin by swapping references until the null value is in a way where the array has no wholes in it.
I have tried different variations of the same logic but either it does absolutely nothing, either I get a nullpointer exception. I am not looking for an explicit answer, just a nudge in the right direction. Is the general idea I proposed earlier worth anything. Can I affect a null value to an arraycell containing a reference to an object.
Thank you in advance for any help.
P.S: Again I apologize, for I know this must be a question that keeps coming up over and over...
Oh, before I forget, are there any good textbooks that explain ina detailed manner class relationships, particularly dependancy, aggregation and inheritance.Why not use a List instead? Lists are dynamic, i.e. they can add or remove
elements anywhere, closing the gap (i.e. there's no need to stuff nulls in there).
Something like this:public class TaskList {
private List l= new ArrayList();
public void add(Task t) { l.add(t); }
public boolean remove(Task t) { return l.remove(t); }
// all the other functionality you want goes here ...
}kind regards,
Jos -
I need help with my remove method on a BST!
Guys I need some help here, I have to create a remove method for a BST and below is my code:
public boolean remove(OrderedMap map, K keyOfelementToRemove) {
boolean result = false;
if (root == null)
result = false;
else {
MapNode curr = root;
MapNode prev = root;
while (curr.key.equals(keyOfelementToRemove) == false) {
prev = curr;
if (keyOfelementToRemove.compareTo(curr.key) < 0)
curr = curr.left;
else if (keyOfelementToRemove.compareTo(curr.key) > 0)
curr = curr.right;
if (curr == null)
break;
if (curr == null)
return result;
else if (curr == root && curr.left == null)
root = root.right;
else if (curr.left == null) {
if (curr.right == null)
curr = null;
else if (curr == prev.left)
prev = curr.right;
else if (curr == prev.right){
prev = curr.right;
else if (curr.left != null) {
MapNode temp = curr.left;
while (temp.right != null)
temp = temp.right;
K change = temp.key;
temp = null;
curr.key = change;
size--;
return result;
}the algorithm that my instructor provides is:
private boolean remove( BinaryTreeNode t, Comparable elementToRemove )
Set result to false
Traverse the tree t until elementToRemove is found. Use curr and prev to find the element
leaving curr referring the node you want to remove. It may be the case that curr is null indicating
that elementToRemove was not found. Now there are four cases to consider :
Case 1: Not found
return result (false)
Case 2: The root is to be removed, but it has no left child.
root = root's right subtree (assuming root refers the the root node in your BST)
Case 3: The node is further down tree with no left child. Now must adjust one of the parent's links
if curr is on the left side of prev,
move parent's left link down to down to curr's right child
else
curr is on the right side of prev, so move parent's right down to down to curr's right child
Case 4: curr has a left child.
We can no longer ignore the left subtree. So find the maximum in the left subtree and
move that object to the node referenced by curr . Then eliminate the maximum in the
left subtree, which is now being reference from the original node to remove.
however for case 3 and 4 it doesn't work, can someone please tell me why? I don't know where I made a mistake and I tried finding it but I still dont knowI am sorry about the double post. I'll try not to do this again. My problem here seems to be that prev and curr aren't updating the BST outside this method, which means that it only changes locally but not permanently. I will post the code of the other headings:
public class OrderedMap<K extends Comparable<K>, V> {
private class MapNode {
// Links to other BSTs
private MapNode left;
private MapNode right;
ArrayList<V> temp1 = new ArrayList<V>();
// The references to the key/value pair of the mapping
private K key;
@SuppressWarnings("unused")
private V value;
public MapNode(K theKey, V theValue) {
key = theKey;
value = theValue;
left = null;
right = null;
} // end class MapNode
private MapNode root;
private int size;
public OrderedMap() { // Create an empty tree
root = null;
size = 0;
public int size() {
return size;
} -
I use EJB3, JPA, JSF in my web application. There are 2 database tables: Teacher and Student. A teacher can have many (or none) students and a student can have at most 1 teacher.
I have a JSF page to print the teacher info and all his students' info. I don't want to load the students' info eagerly because there's another JSF page I need to display the teacher info only. So I have a stateful session bean to retrieve the teacher info and all his students' info. The persistence context in that stateful session bean has the type of PersistenceContextType.EXTENDED. The reason I choose a stateful session bean and an extended persistence context is that I want to write something like this without facing the lazy initialization exception:
<h:dataTable value="#{backingBean.teacher.students}" var="student">
<h:outputText value="${student.name}"/>
</h:dataTable>Because my session bean is stateful, I have a method with the @Remove annotation. This method is empty because I don't want to persist anything to the database.
Now, my question is: How can I make the @Remove method of my stateful session bean be called automatically when my JSF page finishes being rendered?Philip Petersen wrote:
I have a few questions concerning the EJB remove method.
1) What is the purpose of calling the remove method on stateless session
bean?There isn't one.
>
2) What action does the container take when this method is called?It checks that you were allowed to call remove (a security check) and then
just returns.
>
3) What happens to the stateless session bean if you do not call the remove
method?Nothing
>
4) Is it a good practice to call the remove method, or should the remove
method be avoided in the case of stateless session beans?
Personally, I never do it.
-- Rob
>
>
Thanks in advance for any insight that you may provide.
Phil--
AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnWebLogic.com
[att1.html] -
Implement the following method in the class Project 11 to return a new array that contains all the elements of the array a not in b.
Public static int [] remove (int[] a, int[] b)
For example, if the array a is {5,3,2,7,1} and the array b is {8,2,5} the remove method should return the array {3,7,1}.
Im having trouble getting it run correctly, and i think my problem is with the remove method that i made
//heres my code
public static void main(String[]args) {
int [] first = {2,5,4,1,9};
int [] second = {5,10,8,1};
int duplicate =0;
for (int i = 0; i < first.length; i++) {
for (int j =0; j < second.length; j++){
if (first[i] == second[j])
duplicate++;
remove(first, second);
System.out.println(first);
public static int [] remove(int[] a, int []b){
for(int i = 0; i < a.length; i++) {
if(a[i] == b) {
int[] c = new int[a.length - 1];
return c;
return a;im having trouble with the remove method. im suppose to return a new array that contains all the elements of the array a not in b.
Public static int [] remove (int[] a, int[] b)
For example, if the array a is {5,3,2,7,1} and the array b is {8,2,5} the remove method should return the array {3,7,1}.
//heres my code
public static void main(String[]args) {
int [] first = {2,5,4,1,9};
int [] second = {5,10,8,1};
int duplicate =0;
for (int i = 0; i < first.length; i++) {
for (int j =0; j < second.length; j++){
if (first == second[j])
duplicate++;
remove(first, second);
System.out.println(first);
public static int [] remove(int[] a, int []b){
for(int i = 0; i < a.length; i++) {
if(a[i] == b) {
int[] c = new int[a.length - 1];
return c;
return a; -
What is the differenec between 'sap list viewer' and 'abap list viewer'
hi
what is the differenec between 'sap list viewer' and 'abap list viewer'Hi,
There is no difference between them.SAP List Viewer (ALV) is the new name of the ABAP List Viewer (ALV).
The SAP List Viewer unifies and simplifies the use of lists in the R/3 System. A uniform user interface and list format is available for all lists. This prevents redundant functions.
The SAP List Viewer can be used to view both single-level lists and multilevel sequential lists.
Single-level lists contain any number of lines that have no hierarchical relationship to each other.
Multilevel sequential lists consist of any number of lines that have two hierarchical levels. Multilevel lists have header rows and item rows; the item rows are subordinate to the header rows. For each header row there can be any number of subordinate item rows.
You can view subtotals and totals rows in both single-level lists and multilevel sequential lists
From End User Point it is SAP LIST viewer , From Developer Point of View it is ALV .
Check the Below Link
http://help.sap.com/saphelp_nw04/helpdata/en/66/bc7aab43c211d182b30000e829fbfe/frameset.htm
Regards,
Satish -
Need help with a remove method..
Hello. I'm getting started on a project here to implement a recursive remove method that will remove any number from a list. I was given a test that the method must pass, but I'm having some trouble getting started. This is my second interaction with the idea of recursion and it's a bit difficult for me.
Here is the test I'm writing the method for:
public void testRemove() {
int element=0;
boolean inList = false;
for (int i = -10; i < 11; i++)list.insert(i);
int numElements = list.length();
list.remove(element);
for (int e : list) {
if ( e == element ) inList = true;
assertTrue(!inList && (list.length()==(numElements-1)));
element = -10;
inList = false;
list.remove(element);
for (int e : list) {
if ( e == element ) inList = true;
assertTrue(!inList && (list.length()==(numElements-2)));
element = 10;
inList = false;
list.remove(element);
for (int e : list) {
if ( e == element ) inList = true;
assertTrue(!inList && (list.length()==(numElements-3)));
//does remove work when element's value greater than value of last item in list
element = 20;
inList = false;
list.remove(element);
for (int e : list) {
if ( e == element ) inList = true;
assertTrue(!inList && (list.length()==(numElements-3)));
//does remove work when element's value less than value of first item in list
element = -20;
inList = false;
list.remove(element);
for (int e : list) {
if ( e == element ) inList = true;
assertTrue(!inList && (list.length()==(numElements-3)));
System.out.printf("%s\n", "testRemove " + list.toString());
}Now, clearly I need to test whether or not the number being removed is in the list (too low/too high), but I'm stuck trying to implement this.
If anyone can give me any ideas or direction it would be greatly appreciated.Thanks for the quick reply, from what I had gathered and what you posted I'm starting to see where I need to go from here. I had gotten as far as if list is null return null, and the cod that you posted makes sense, but implementing it into the source code I already have will be troubling for me. The code as you presented it I have no trouble understanding, for example:
if (list.data == data) return list.next;
list.next=remove(list.next, data);Is clear to me, however I don't know how to implement that into my code. This is the code for the insert method:
private Node<ElementType> insertp(Node<ElementType> list, ElementType element) {
if ( (list == null) || ( element.compareTo(list.getElement() ) < 0 ) ) {
// test for insert at head or before current node
Node<ElementType> newNode = new Node<ElementType>(element, null);
newNode.setNext(list);
return newNode;
else if (list.getNext() == null) { // list with one element
Node<ElementType> newNode = new Node<ElementType>(element, null);
list.setNext(newNode); // element goes at end
else if ( element.compareTo(list.getNext().getElement()) < 0 ) { // insert after list
Node<ElementType> newNode = new Node<ElementType>(element, list.getNext());
//newNode.setNext(list.getNext());
list.setNext(newNode);
else {
insertp(list.getNext(), element); // find insertion point
return list;
}I'm still struggling to understand all of the code there. the element.compareTo() and everything. If you (or some one else) can explain to me what is going on with those methods, I may be able to implement it myself. Also, this may be of some use, these are the methods I have available to me:
public class Node<E> {
// Instance variables:
private E element;
private Node<E> next;
/** Creates a node with null references to its element and next node. */
public Node() {
this(null, null);
/** Creates a node with the given element and next node. */
public Node(E e, Node<E> n) {
element = e;
next = n;
// Accessor methods:
public E getElement() {
return element;
public Node<E> getNext() {
return next;
// Modifier methods:
public void setElement(E newElem) {
element = newElem;
public void setNext(Node<E> newNext) {
next = newNext;
public String toString() {
return element.toString();
} -
What happens if you don't define '@Remove' method for Stateful SessionBean?
Hi,
I'm new to ejb3.
I've noticed that the spec doesn't force you to define a "@Remove" method on a stateful Session bean... which seemed a bit weird/dangerous to me...
Would anyone please happen to know:
1. Is there a special treatment for Staeful SB's that don't have "@Remove"? Like, for examle, will the container destroy the session automatically at some point (after each remove invocation ? After a fixed timeout ? etc).
2. And what if the programmer defined '@Remove' but neglected to call it from the client ? Are there different rules ? Session timeout ?
Thanks a lot !There are always ways in which the container can decide to remove a Stateful Session Bean(SFSB) that are completely independent of whether a client explicitly calls a remove method. The container can choose to remove a SFSB because it has timed out. The actual time out is typically configurable, much like HttpSession timeout. The container can also remove a SFSB due to a system exception generated from one of its methods.
@Remove methods merely expose an application-specific way to force the removal of a SFSB. They are not required to be defined and even if defined are not required to be invoked.
--ken -
Bad logic in NamedCache remove method?
Why does the remove method in a NamedCache invoke the load method in the CacheStore in a distributed cache? Why force a database load call for the object if it doesn't exist in the cache only to immediately remove it?
Edited by: 786216 on Aug 3, 2010 10:07 AMHi 786216,
The reason for that comes to the contract of the java.util.Map#remove(Object) method that NamedCache inherits is to return the "old" value. Basically, the net effect should be the same as:
oValue = map.get(oKey);
map.removeBlind(oKey); // pretend such a method exists
return oValue;The good news is that the removeBlind() method does exists. It looks like:
map.keySet().remove(oKey);and will not cause the store.load() operation to occur.
Regards,
Gene -
Linked list remove method???
hi i have made a remove method in a publication contaqiner class which links to the publicationmain.The problem is that when i run the program and try to delete a publication i get the message
"Exception in thread "main" java.lang.IndexOutOfBoundsException: Index:1, Size:1 at java.util.LinkedList.entry<LinkedList.java:348>
java.util.LinkedList.remove<LinkedList.java:338>
PublicationContainer.remove<publicationcontainer.java>
publicationmain.main<publicationmain.java>"
What does this mean?how do i fix it so my delete method workks?can ssomeone please show me in my code???thanxs
//this is in the publication container
public void remove(int PubID)
PubList.remove(PubID);
//this is in the publicationmain class
System.out.println ("Enter Publication ID:");
PubID = Keyboard.readInt();
pubdatabase.remove (PubID);The remove(int index) method that you are calling will try and remove the item at the index you specify.
As the index starts at zero, if you want to remove the first element then you have to call remove(0). Calling remove(1) is beyound the possible indexes in the list, so you will get the exception thrown.
HTH
Chris
hi i have made a remove method in a publication
contaqiner class which links to the
publicationmain.The problem is that when i run the
program and try to delete a publication i get the
message
"Exception in thread "main"
java.lang.IndexOutOfBoundsException: Index:1, Size:1
at java.util.LinkedList.entry<LinkedList.java:348>
java.util.LinkedList.remove<LinkedList.java:338>
PublicationContainer.remove<publicationcontainer.java>
publicationmain.main<publicationmain.java>"
What does this mean?how do i fix it so my delete
method workks?can ssomeone please show me in my
code???thanxs
//this is in the publication container
public void remove(int PubID)
PubList.remove(PubID);
//this is in the publicationmain class
System.out.println ("Enter Publication ID:");
PubID = Keyboard.readInt();
pubdatabase.remove (PubID); -
Hi,
I have a entity EJB with following methods:
findByPrimaryKey(PK)
create(PK)
get and set methods
I wanna add a remove method which will take the PK and delete the record for
me.
Please tell me the changes I have to incorporate. and How do i do it. I am using VA 3.5 and WAS 3.5
Thanx & Regards
Ravi Mittalhi,
after adding access bean & generating deployed code you have to add remove method in Access Bean by yourself. remove(object) is in EJBhome interface.
you have to pass object of key class. so add empty remove() in acees bean. instantiate ur key class there & call remove(keclassobject) method. I think it will help you.
-priya
Maybe you are looking for
-
Creating a dynamic SQL query builder class
I have a jobs table where each row contains information about jobs run on a machine. I have a web view of this database which shows different information and queries for this information are built using the following fields: TYPE TITLE NODE STATUS (a
-
HT201364 Mavericks Upgrade Problems
Hi, Im not sure why i cant upgrade to Mavericks as i think my mac meets the requirements? Im running OS X 10.6.8, have 2gb of memery and plenty of hard drive space. Any suggestions?
-
Will OBIEE Support creating reports from 2 different data sources
Hello Guys I am new to BI . Can anybody let me know how to create a report using 2 different data sources . Ex: Suppose we have 10G and SQL server , can we import tables to rpd and join 1 fact & dimension from 10G and 1 Fact from SQL server to the 10
-
How many at-exit commands are allowed in the pbo.
hi how many at-exit commands are allowed in the pbo.
-
OS X has failed to install on my macbook pro and now it keeps trying to install when the computer restarts and I cannot get back to how it was and ditch the upgrade! Can you tell me how to do this please?