Hi.
I can't figure out how to remove an element from an array.
will I have to move get the element to be removed and swap it out with the last element and use the pop()?

Arrays do not have a "pop()" method - they are fixed storage. You can null out elements or shift them out of existence.

Arrays do not have a "pop()" method - they are fixed storage. You can null out elements or shift them out of existence.

Great, no wonder I am confused. I don't know where I got the pop() from. some other language I guess. So I could just make a new array omitting the element I don't want.
thanks

Just for your reference.
In Pyphon the list data type has a method: pop().
list.pop()
removes the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list. (The square brackets around the i in the method signature denote that the parameter is optional, not that you should type square brackets at that position. You will see this notation frequently in the Python Library Reference.)

Edited 6 Years Ago by tong1: n/a

Just for your reference.
In Pyphon the list data type has a method: pop().
list.pop()
removes the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list. (The square brackets around the i in the method signature denote that the parameter is optional, not that you should type square brackets at that position. You will see this notation frequently in the Python Library Reference.)

Thanks. I know you can push or pop() an object into an array
in action Script (flash) too. Maybe I saw it there.

Right now my computer with my code has crashed I will have to
get back with the exact code later.
I am trying to check a database actually. I have 4 tables
temp[admin_,stu_,instructor_,norm_,payee_]<--profiles will tell
me which table to check.

I am looking for uid's and if I am trying to delete and admin_
profile with uid fooUser I need to check every other table except
the admin table. so the new array would be temp2[stu_,instr_,norm_,
payee] this is one way but I would prefer to learn how to manipulate the curser
of an rs of (embedded db) preparedStatement.

I have a mapping table with all the profile/user columns.
I would much rather use the rs to see if fooUser is in any other
table using the mapping table but I need to learn more on
moving the curser in rs so I can make sure if finds records
but I don't know if rs.next() will stop when it finds admin_/fooUser
before it checks if fooUser is in another record with a different
profile.

the Question:
can the curser of an rs
be moved to the next record if it finds admin_ first?

I can be more exact as soon as I get win7 running.
thanks

I am trying to build tempArray with profiles
except the one that was passed.

Why is it that temp array shows it stillhas allthe profiles
5 profiles total. tempArray should have 4.

public boolean isMultipleProfileControlUserTable(String thisProfile, String thisUid) throws UnknownUserNameException, SQLException, IncorrectPasswordException, LoginException, FileNotFoundException, IOException, ProfileException {

        String M =(" --> isMultipleProfileControlUserTable("+thisProfile+c+thisUid+") var: thisProfile :thisUid<-- \n");
        System.out.println(M);
        String[] tempArray = new String[PROFILEARRAY.length];
        bDelete = false;
[b]
        for (int i = 0; i < PROFILEARRAY.length; i++) {
            if (!PROFILEARRAY[i].equals(thisProfile)) {
                tempArray[i] = PROFILEARRAY[i];
                System.out.println(C + M + AND + tempArray[i] + ":build tempArray[" + i + "] : \n");
            }
         System.out.println(C+M+AND+thisProfile+":xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx : \n");
[/b]
[b][i]until the array works below code is unpredictable[/i][/b]
            conn = connect();
            System.out.println(C + M + AND + "xml :\n" + ModelUtils.getXMLResource("userGroupMappingIsMultiple") + ": : ");
            ps = (PreparedStatement) conn.prepareStatement(
                    ModelUtils.getXMLResource("userGroupMappingIsMultiple"));

            System.out.println(C + M + AND + thisUid + ": thisUid : ");
            ps.setString(1, thisUid);
            rs = ps.executeQuery();
            while (rs.next()) {
 System.out.println(C+M+AND+thisProfile+":rs___while(rs.next())_________rs___________rs______________rs : \n");
                if (rs.next()) {
                    String temp = rs.getString(1);
                     System.out.println(C+M+AND+temp+": var temp: working profiles of rs.next() : the groupId \n");
                    

                }
                for (int j = 0; j < tempArray.length-1; j++) {
                     System.out.println(C+M+AND+thisProfile+":rs____for loop________rs___________rs______________rs : \n");
                    System.out.println(C + M + AND + tempArray[j] + ": tempArray[" + j + "] : working rs.next() :");
                    if (temp.equals(tempArray[j])) {
                        bDelete = false;
                        System.out.println(C+M+AND+thisProfile+bDelete+":rs____returns bDelete________rs___________rs______________rs : \n");
                    }
                }
            }
        }

        System.out.println(C + M + AND + bDelete + ": returns : bDelete : should user_ record be deleted? ");
        return bDelete;
    }

in theory profle_ should not be in tempArray
output

CLASS 
 RemoveFormActions: 
payeeDeleteAction() : : caller 
--->: ugm.isMultipleProfile(payee_ , payee1) : var: thisProfile : thisUid <-----

 --> isMultipleProfileControlUserTable(payee_ , payee1) var: thisProfile :thisUid<-- 

CLASS 
 ConnectUserGroupMappingMappingDAO: 
 --> isMultipleProfileControlUserTable(payee_ , payee1) var: thisProfile :thisUid<-- 
[b] : admin_,stu_,instr_,payee_,norm_:build tempArray[0] : [/b]

CLASS 
 ConnectUserGroupMappingMappingDAO: 
 --> isMultipleProfileControlUserTable(payee_ , payee1) var: thisProfile :thisUid<-- 
 : payee_:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx :
This question has already been answered. Start a new discussion instead.