Links List description column
How to get the description value of the hyperlink field in the link list for xslt list view webpart ? i.e how do I get the value of description in the XSLT that I provide for XslLink?
Hi,
If there is a hyperlink field in your list view, then there would be a variable “$desc” in the xslt code, you can call it like this:
<xsl:value-of select="$desc"/>
Here are two links with code samples about how to customize the the rendering of a hyperlink field for your reference:
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/68b05f40-9b62-485b-ba8e-4684a7e34899/truncate-url-in-xslt-view
http://sharepoint.stackexchange.com/questions/58672/painless-way-to-display-hyperlink-as-url
More information about XSLT language:
http://www.w3schools.com/xsl/
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
contact [email protected]
Patrick Liang
TechNet Community Support
Similar Messages
-
Errors executing bulk query when updating a Sharepoint Linked List from Access
Hi all,
I have a Sharepoint list that is a Linked List with MS Access. It has just under 5,000 items (4,864), thus meaning it avoids the reduction in functionality lists of greater than 5,000 items have.
Among the list are five calculated columns. These take the information from another column (different employee numbers), and by using a formula produce a clickable link to my company's Directory page, where that particular employee's info is displayed. I'm
not sure if these five columns are relevant to my query, but I'm mentioning them in case.
My problem is this: Frequently when I run any query on the list that updates the list, I get this error: "There were errors executing the bulk query or sending the data to the server. Reconnect the tables to resolve the
conflicts or discard the pending changes".
When I review the errors, it says they conflict with errors a previous user made (with that previous user being me). It frequently highlights several columns, despite the info in them being identical, and the calculated columns (with the original showing
the value they contained and the new showing #VALUE! (as Access can't display the formulas).
However, if I click Retry All Changes, all the update stick and everything seems fine. Why is this happening? It's proving very annoying and is really stopping the automation of my large number of queries. A list of 5000 items isn't particular big (and they've
got roughly 100 columns, although I didn't think that was too large either, given Excel's 200+ column limit).
Is this due to poor query design and SQL? Is this due to connectivity issues (which I doubt, as my line seems perfect)? Is this due to Access tripping over itself and not executing the update on each row in the table, but rather executing them concurrently
and locking itself up? I'm at wit's end about it and really need to get this sorted.
Thanks in advance for any suggestions.Hi amartin903,
According to your description, my understanding is that you got an error when you used a linked list from Access.
The table that you are updating is a linked table that does not have a primary key or a unique index. Or, the query or the form is based on a linked table that does not have a primary key or a unique index. Please add the primary key or a unique index.
Here is a similar post, please take a look at:
http://social.technet.microsoft.com/Forums/en-US/545601e9-a703-4a02-8ed9-199f1ce9dac8/updating-sharepoint-list-from-access?forum=sharepointdevelopmentlegacy
I hope this helps.
Thanks,
Wendy
Wendy Li
TechNet Community Support -
Open Sharepoint Link List items in new tab?
I have a sharepoint list which is Link List.Actually When I click on item in that link list it should be open in the new tab/window
Hi,
According to your description, you might want to open Link list items in a new tab/windows.
If it is not a must behavior to use the “URL” column to hold the hyperlink, I would suggest you use “Hyperlink with formatting and constraints for publishing” column
instead which can let users decide to open the hyperlink in a new tab or not.
It is required to activate the “SharePoint Server Publishing Infrastructure” in the “site collection features”, create a column of this type in “Site Settings ->
Web Designer Galleries -> Site Columns”, then you can add it into your list.
Here is a link about how to add publishing columns to content types, lists, or libraries, you could use it as a reference:
https://support.office.com/en-ie/article/Add-publishing-columns-to-content-types-lists-or-libraries-4e268d2e-4822-4bc6-a992-88287119a052#__toc337727282
Best regards
Patrick Liang
TechNet Community Support -
How to use circular linked list in pl/sql?
Hi all,
how to use the circular linked list on pl/sql programming.
thanks in advance
Rgds,
B@L@d balamurugan wrote:
Hi,
I needed this concept for the below example
TABLE_A have the columns of
ID COL_1 COL_2 COL_3 COL_4 COL_5 COL_6 COL_7
1....Y.........N........N.........Y........ N........N........ N
2....N.........N....... N.........Y.........N........N.........Y
in the above data
for id 1 i will need to take the value for COL_4, then i will check the next availability of Y through out through out the remaining columns, so next availability is on COL_1 so, i need to consider COL_4 which already Y and also i need to consider COL_5, COL_6, COL_7 as Y.
for id 2 if i need COL_7 then i need to come back on circular way and need to check the next availability of Y and need to take the columns having N before the next availability of YAnd... even after all that description... you haven't given any indication of what the output should look like.
Taking a wild guess on my part... something like this would do what you appear to be asking...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as id, 'Y' as col1, 'N' as col2, 'N' as col3, 'Y' as col4, 'N' as col5, 'N' as col6,'N' as col7 from dual union all
2 select 2, 'N', 'N', 'N', 'Y', 'N', 'N', 'Y' from dual)
3 --
4 -- END OF TEST DATA
5 --
6 select id
7 ,rcol
8 ,case when instr(cols,'Y',rcol+1) = 0 then instr(cols,'Y')
9 else instr(cols,'Y',rcol+1)
10 end as next_Y_col
11 from (select id, rcol, col1||col2||col3||col4||col5||col6||col7 as cols
12 from t, (select &required_col as rcol from dual)
13 where id = &required_id
14* )
SQL> /
Enter value for required_col: 4
old 12: from t, (select &required_col as rcol from dual)
new 12: from t, (select 4 as rcol from dual)
Enter value for required_id: 1
old 13: where id = &required_id
new 13: where id = 1
ID RCOL NEXT_Y_COL
1 4 1
SQL> /
Enter value for required_col: 7
old 12: from t, (select &required_col as rcol from dual)
new 12: from t, (select 7 as rcol from dual)
Enter value for required_id: 2
old 13: where id = &required_id
new 13: where id = 2
ID RCOL NEXT_Y_COL
2 7 4
SQL>If that's not what you want... then it's time you started learning how to ask questions properly. -
In SharePoint 2010 , I have version history enabled multiple text box 'issue details'. Users mainly uses Data Sheet view and it does not show all version history of that multiple line text box, is there anyway we can display list view column in
data sheet view to display all version history?
2) If we can not display in datasheet view, in standard view, it should display all version history instead of just a link to -view all entries'
I have found one article here and it posts to use below line of code in sharepoint desinger
<SharePoint:AppendOnlyHistory runat="server" ItemId="{$thisNode/@ID}" FieldName="Issue_x0020_Details" ControlMode="Display"></SharePoint:AppendOnlyHistory>
WHen I use this line of code , it displays multiple line of same version history instead of each, please help.Hi
Greetings. Hope it helps
https://social.technet.microsoft.com/Forums/sharepoint/en-US/d1be5434-7dc9-4941-bf1d-8c12d7e6a155/display-version-history-in-list-view-column?forum=sharepointcustomizationlegacy
Please remember to click 'Mark as Answer' on the answer if it helps you -
A linked list question.
So, I believe I understand linked lists for the most part, except for two lines....
boolean add(Transaction item)
for (Transaction curr = first; curr != null; curr = curr.next)
if (curr.part_num == item.part_num)
return false;
Transaction newItem = new Transaction();
newItem.transcode = item.transcode;
newItem.description = item.description;
newItem.part_num = item.part_num;
newItem.quantity = item.quantity;
newItem.next = first;
first.next = newItem;
return true;
}first is null, so First.next would be the first available space for actual insertion, and this is why it then puts null as newItem.next (the end of the list), and sticks newItem in first.next?
Im glad I read that pass by value thing earlier at the Java Ranch place...
Heres my actual question: When newItem.next = first; is called, it just copies null as the next field, but leaves the null in first alone right? And then it takes first.next and makes newItem copy into that field, thus inserting the first real item in the list?
Please tell me I made that connection right. :-D
Thanks!!Pictures are worth a hundred words with linked lists. Did you even put a pencil and paper next to your computer while doing this program, so that you could draw what is happening when you get confused?
If first is null, then the for loop is skipped--because first is assigned to curr and the loop only executes when curr is not equal to null.
So, this happens:
newItem = new Transaction()
int Transcode = 0
String description = null
int partNumber = 0
int quantity = 0
Tranasaction next = nullThen values are assigned to each field:
newItem
int Transcode = 10
String description = "screw"
int partNumber = 46
int quantity = 200
//freeze execution here:
Tranasaction next = null (what will happen here??)Your assumption was:
Transaction first = null
That means first does not refer to a Transaction object. Therefore, first does not have a description member, a quantity member, etc., and this is what things look like just before newItem.next = first; is executed:
newItem ----> Transaction
int Transcode = 10
String description = "screw"
int partNumber = 46
int quantity = 200
Tranasaction next = null
first ------> nullNow,
When newItem.next = first; is calledthings change to this:
newItem ----> Transaction
int Transcode = 10
String description = "screw"
int partNumber = 46
int quantity = 200
/-------Tranasaction next
first ------> null That isn't what you want. When you add() a Transaction object to the end of your linked list, it's next member should be null. It's the end of the chain, so there is no next.
And then it takes first.next and makes newItem copy
into that field, thus inserting the first real item in the
list?No. first is null so it does not refer to a Transaction object, and therefore there is no next member variable and consequently no such thing as first.next. You need to understand that null and a Transaction object that has 0 for every member are not the same.
But suppose for a minute that null and a Transaction object with zeros for every field were the same thing, so that first.next existed. If that was the case, then you could assign newItem to first.next. But, then you would be left with this:
first
int Transcode = 0
String description = null
int partNumber = 0
int quantity = 0
Tranasaction next = newItemWould you want the first Transaction object in your LinkedList to be almost entirely empty?
Instead, if first is null, you want to make first refer to newItem, i.e. you want to do this:
newItem ----> Transaction
int Transcode = 10
String description = "screw"
int partNumber = 46
int quantity = 200
Tranasaction next = null
first ----/ nullThen when the add() method ends, since newItem is a local variable, it will be destroyed leaving you with this:
Transaction
int Transcode = 10
String description = "screw"
int partNumber = 46
int quantity = 200
Tranasaction next = null
first ----/ null -
When you are doing links in a column, and there is not much room so you want them to sit one on top another, if you use
<p> </p> they are to far apart and take up to much room, so what mark up do you use. can any one help please.Use unordered list <ul> <li> tags.
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
Use CSS to style the list as needed:
http://www.w3schools.com/css/css_list.asp
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb
http://alt-web.blogspot.com/ -
How to add a Description Column in the Content Panel (Bridge CS5)
Hi,
Is it possible to add a Description Column in the Content Panel. If so, how?
I'm talking about the Description from the IPTC Core data and I'm using Bridge CS5.
Thanks in advance,
FrankThis is the screenshot of the Metadata Workspace with the Content Panel (not Metadata Panel). As you can see it shows Name, Label, Keywords etc. but it's not possible to show Description in that list as a column.
I still agree that it would be a big bonus if you could alter this workspace with description field (even with more lines etc) but what Curt shows you might be an alternative. I couldn't help noticing that you have not created your own custom workspaces.
Try and play with this. You have the option to divide the window in 3 columns max but you can create different panels as a row in 1 column.
Grabbing a tab and move it to a new location until a single blue line appears (between the borders, a bit tricky). A vertical blue line means as a column and a horizontal line means a row. A surrounding blue line means same panel but adding as a tab. You can rearrange the tabs by dragging to left or right. under the menu window you can select which panels are visible or use right mouse click menu on top of a panel to choose.
Sadly enough only 3 columns and only one panel of it's kind per workspace, but you can resize the panels also to your own workflow needs.
In Bridge preferences you can change the colors for background in the general tab and in the metadata tab you can select what info to view in certain sections. Personally I have set my IPTC to view only description, keywords, date created and a few other subjects.
That is the nice thing about Bridge, creating custom workspaces, save them and being able to recreate them without problems :-)
I attach some screenshot of my daily workflow (with the luxury of having a 30' screen) but there are plenty of other options possible, don't forget to name and save your workspace. -
IR: Selection List in Column Header
Hi,
does anybody know if it is possible to add a selection list to the headings of an interactive report?
I have several columns with frequency fields and want to have the possibility to select in the header of each column the unit (MHz, GHz, KHz, Hz) in which the frequency has to be calculated.
KirstenHi Mermaid0614,
I checked it in MTM 2012, MTM2013, there isn’t the Description option of column in contents view in MTM. I also check it in the web access, there isn’t that column too.
However we could get the description column in the query in MTM.
So, I suggest that you could check the description column value in the query. (Track=>Queries)
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Can you create two separate tile views for a Promoted Links List
I have lots of pages on my site where i want the effect of the promoted links list tile view. However, i don't want the same links to show up on every spot i use it. Is there not a way to create separate tile views so you can create filtering conditions?
Right now i am stuck having 5 separate lists with 5 items in each because of this limitation. Am i missing something?
I look forward to your responses.
~ZachThere is an easy way to do this.
Add columns to the Promoted Links list.
Add a column named Page.
Type in name of the page on which you would like this link to appear.
Add a column named Row.
Create a view filtered by page name and Row. Example: Show only when Page = HomePage AND Row = 1
Create another view filtered by page name and another Row. Example: Show only when Page = HomePage AND Row = 2.
Go the page you would like the links to appear. Edit the Page.
Add Promoted Links app part (still not used to the app thing) and select your view for Row 1
Add another Promoted Links app part and select the view for Row 2.
Lather, Rinse and Repeat.
Tamara Bredemus SharePoint Minion...working up to Maven -
Customizing List View Column Location
Can anyone help me remember how I take off certain columns in List View such as Lens, Orientation etc?
I am looking in the Customizing Aperture Workspace section of the Help and I can't seem to find this.
TIASorry, was getting some _very_ important work done -- have a mega-big project going out the door -- here's the top link from a search of the User Manual for "List View Column":
Working with Images in List View -
I desparately need help with these topic. Currently, I am doing a project using doubly link list data structure and swing components. However, I just could not get the data items of the doubly link list to display on the JTextArea. Is this possible at all or does anybody out there know in anyway to solve this problem?
Thanks a lot for the timely reply amolk. Here is the sample code you request for:
//The following code is my Link class:
import java.io.Serializable;
public class Link implements Serializable
public String dTitle, dPublisher, dCategory, dUserlevel, dDescription, dISBN, dDay, dMonth, dYear;
public float dPrice;
public int dQuantity;
public Link next; // next link in list
public Link previous; // previous link in list
public Link(String tit, String pub, String cat, float price, int qty, String ISBN, String day, String month, String year, String level, String des) // constructor
dTitle = tit;
dPublisher = pub;
dCategory = cat;
dPrice = price;
dQuantity = qty;
dISBN = ISBN;
dDay = day;
dMonth = month;
dYear = year;
dUserlevel = level;
dDescription = des;
public void displayLink()
System.out.println(dTitle + "");
} // end class Link
//The following is the actual doubly link list code
import java.io.Serializable;
public class DoublyLinkedList implements Serializable
public String back;
public boolean notFound = false;
private Link first; // ref to first item
private Link last; // ref to last item
public DoublyLinkedList() // constructor
first = null; // no items on list yet
last = null;
public boolean isEmpty() // true if no links
return first==null;
public void insertFirst(String title, String publisher, String category, float price, int quantity, String ISBN, String day, String month, String year, String userlevel, String description) // insert at front of list
Link newLink = new Link(title, publisher, category,price, quantity, ISBN, day, month, year, userlevel, description); // make new link
if( isEmpty() ) // if empty list,
last = newLink; // newLink <-- last
else
first.previous = newLink; // newLink <-- old first
newLink.next = first; // newLink --> old first
first = newLink; // first --> newLink
public Link deleteFirst() // delete first link
{ // (assumes non-empty list)
Link temp = first;
if(first.next == null) // if only one item
last = null; // null <-- last
else
first.next.previous = null; // null <-- old next
first = first.next; // first --> old next
return temp;
public void displayForward()
System.out.println("first --> last): ");
Link current = first; // start at beginning
while(current != null) // until end of list,
current.displayLink(); //display data
current = current.next; // move to next link
System.out.println("");
//Hoping to hear from you soon. -
Help Implementing a queue as a circular linked list...
I have a set of code that I need to implement a circular linked list into, but I am not sure how to approach it at all. If anyone can point me to some pseudo code or sample code that I can modify for my use, that would be great.
I created a Class CircularQueue, which implements Queue, I just need to figure out how to write it.
Heres the code I have:
Queue Interface
public interface Queue<ElementType> {
public void enqueue(ElementType e);
public ElementType dequeue();
public ElementType front();
public boolean isEmpty();
Data Holder
public class DataHolder<ElementType> {
// instance variables
private ElementType _data;
* Constructor for objects of class DataHolder
public DataHolder() {
_data = null;
public void setContents(ElementType anItem) {
_data = anItem;
public ElementType getContents() {
return _data;
DeqeueButton
import javax.swing.*;
import java.awt.event.*;
public class DequeueButton extends JButton {
// instance variables
private Queue<SmartRectangle> _queue;
private QueuePanel _queuePanel;
* Constructor for objects of class DequeueButton
public DequeueButton(QueuePanel aQueuePanel) {
super("Dequeue");
_queuePanel = aQueuePanel;
_queue = aQueuePanel.getQueue();
this.addActionListener(new DequeueButtonListener());
private class DequeueButtonListener implements ActionListener {
private final int MOVE_LENGTH = 25; // square size + 5
public void actionPerformed(ActionEvent e) {
_queue.dequeue(); // remove item from queue
_queuePanel.repaint();
EnqueueButton
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class EnqueueButton extends JButton {
// instance variables
private Queue<SmartRectangle> _queue;
private QueuePanel _queuePanel;
* Constructor for objects of class EnqueueButton
public EnqueueButton(QueuePanel aQueuePanel) {
super("Enqueue");
_queuePanel = aQueuePanel;
_queue = _queuePanel.getQueue();
this.addActionListener(new EnqueueButtonListener());
private class EnqueueButtonListener implements ActionListener {
private int _nextX, _nextY;
private final int SQUARE_SIZE = 20;
private final int MAX_X = 550;
private final int MAX_Y = 350;
private Color _currentColor;
public EnqueueButtonListener() {
_currentColor = Color.BLUE;
_nextX = MAX_X;
_nextY = MAX_Y;
public void actionPerformed(ActionEvent e) {
_queue.enqueue(new SmartRectangle(_nextX, _nextY, SQUARE_SIZE, SQUARE_SIZE, _currentColor, _queuePanel));
this.changeColor();
_nextX -= (SQUARE_SIZE+5); // location of next square in line
if (_nextX < 0) // if we reach edge of window, wrap
{ _nextY -= (SQUARE_SIZE+5);
_nextX = MAX_X;
if (_nextY < 0) // start over
_nextY = MAX_Y;
_queuePanel.repaint();
public void changeColor() {
if (_currentColor == Color.BLUE)
_currentColor = Color.RED;
else if (_currentColor == Color.RED)
_currentColor = Color.GREEN;
else if (_currentColor == Color.GREEN)
_currentColor = Color.YELLOW;
else if (_currentColor == Color.YELLOW)
_currentColor = Color.BLACK;
else if (_currentColor == Color.BLACK)
_currentColor = Color.BLUE;
FrontButton
import javax.swing.*;
import java.awt.event.*;
public class FrontButton extends JButton {
// instance variables
private Queue<SmartRectangle> _queue;
private QueuePanel _queuePanel;
* Constructor for objects of class DequeueButton
public FrontButton(QueuePanel aQueuePanel) {
super("Front");
_queuePanel = aQueuePanel;
_queue = aQueuePanel.getQueue();
this.addActionListener(new FrontButtonListener());
private class FrontButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
SmartRectangle rectangle = _queue.front(); // remove item from queue
SmartRectangle displayRect = _queuePanel.getDisplayFrontRect();
if (rectangle != null)
displayRect.setColor(rectangle.getColor());
_queuePanel.repaint();
QueueApp
import javax.swing.*;
import java.awt.*;
public class QueueApp extends JFrame
* Constructor for objects of class QueueApp
public QueueApp(String title)
super(title);
this.setSize(600,450);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
QueuePanel queuePanel = new QueuePanel();
javax.swing.JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(new EnqueueButton(queuePanel));
buttonPanel.add(new DequeueButton(queuePanel));
buttonPanel.add(new FrontButton(queuePanel));
this.add(queuePanel, BorderLayout.CENTER);
this.add(buttonPanel, BorderLayout.SOUTH);
this.setVisible(true);
public static void main (String [] args)
QueueApp app = new QueueApp("Queues at work: Object Oriented implementation.");
QueuePanel
import javax.swing.*;
import java.awt.*;
public class QueuePanel extends javax.swing.JPanel {
// instance variables
private Queue<SmartRectangle> _queue;
private SmartRectangle _frontRect;
* Constructor for objects of class QueuePanel
public QueuePanel() {
super();
_queue = new CircularQueue<SmartRectangle>();
_frontRect = new SmartRectangle(50,50,20,20,Color.WHITE, this);
public Queue<SmartRectangle> getQueue() {
return _queue;
public SmartRectangle getDisplayFrontRect() {
return _frontRect;
public void paintComponent(Graphics aBrush) {
super.paintComponent(aBrush);
Graphics2D aBetterBrush = (Graphics2D) aBrush;
Queue<SmartRectangle> tempQueue = new CircularQueue<SmartRectangle>();
if (_frontRect.getColor() != this.getBackground())
_frontRect.fill(aBetterBrush);
while (!_queue.isEmpty()) { // remove and display contents
SmartRectangle rectangle = _queue.dequeue();
rectangle.fill(aBetterBrush);
tempQueue.enqueue(rectangle);
while (!tempQueue.isEmpty()) { // put contents back into _queue
_queue.enqueue(tempQueue.dequeue());
_frontRect.setColor(this.getBackground());
SmartNode
public abstract class SmartNode<ElementType> {
public abstract boolean isEmpty();
public abstract SmartNode<ElementType> dequeue(DataHolder<ElementType> aHolder);
public abstract void front(DataHolder<ElementType> aHolder);
public void enqueue(ElementType anItem){}
public void setNext(SmartNode<ElementType> aNode) {
} // override as needed
public void setPrev(SmartNode<ElementType> aNode) {
} // override as needed
SmartRectangle
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
public class SmartRectangle extends Rectangle2D.Double {
// instance variables
private JPanel _panel;
private Color _color;
* Constructor for objects of class SmartRectangle
public SmartRectangle(int x, int y, int aWidth, int aHeight, Color aColor,
JPanel aPanel) {
super(x, y, aWidth, aHeight);
_panel = aPanel;
_color = aColor;
public void setLocation (int x, int y) {
this.setFrame(x, y, this.getWidth(), this.getHeight());
public Color getColor() {
return _color;
public void setColor(Color aColor) {
_color = aColor;
public void fill(Graphics2D aPaintBrush) {
Color savedColor = aPaintBrush.getColor();
aPaintBrush.setColor(_color);
aPaintBrush.fill(this);
aPaintBrush.setColor(savedColor);
}> Yea I think I understand the concept of it, but I
dont know what the code is supposed to look like.
Showing you what the code is supposed to look like would be effectively giving you the answer, which kind of defeats the purpose of "extra credit". Have you tried anything so far? Post what you've got, and we can give you hints on how to work through it. I thought some of the descriptions here were very explicit hints, but if you need some additional guidance, let us know your specific questions (other than "show me the code").
Good luck!
~ -
Creating a Link on the Column Heading
Good afternoon,
I know with reports, you can create a link for each cell in the report attributes section. My question is it there's any way to create a link for the column header without hard coding it into the query that generating the results.
Thanks in advance,
IvanIvan,
If you are using the classical reports, you have the option of creating column header using pl-sql block which will be dynamic. Thanks
Regards,
Manish -
After Delete in Linked list...unable to display the linked list
Hi...i know that there is an implementation of the class Linked Link but i am required to show how the linked list works in this case for my project...please help...
Yes..I tried to delete some objects in a linked list but after that i am not able to display the objects that were already in the linked list properly and instead it throws an NullPointerException.
Below shows the relevant coding for deleting and listing the linked list...
public Node remove(Comparator comparer) throws Exception {
boolean found = false;
Node prevnode = head; //the node before the nextnode
Node deletedNode = null; //node deleted...
//get next node and apply removal criteria
for(Node nextnode = head.getNextNode(); nextnode != null; nextnode = nextnode.getNextNode()) {
if(comparer.equals(nextnode)) {
found = true;
//remove the next node from the list and return it
prevnode.setNextNode(nextnode.getNextNode());
nextnode.setNextNode(null);
deletedNode = nextnode;
count = count - 1;
break;
if (found) return deletedNode;
else throw new Exception ("Not found !!!");
public Object[] list() {
//code to gather information into object array
Node node;
Object[] nodes = new Object[count];
node = head.getNextNode();
for (int i=0; i<count; i++) {
nodes[i] = node.getInformation(); // this is the line that cause runtime error after deleting...but before deleting, it works without problem.
node = node.getNextNode();
return nodes;
}Please help me in figuring out what went wrong with that line...so far i really can't see any problem with it but it still throws a NullPointerException
ThanksOK -- I've had a cup and my systems are coming back on line...
The problem looks to be the way that you are handling the pointer to the previous node in your deletion code. Essentially, that is not getting incremented along with the nextNode -- it is always pointing to head. So when you find the node to delete then the line
prevnode.setNextNode(nextnode.getNextNode());will set the nextNode for head to be null in certain situations (like if you are removing the tail, for instance).
Then when you try to print out the list, the first call you make is
node = head.getNextNode();Which has been set to null, so you get an NPE when you try to access the information.
Nothing like my favorite alkaloid to help things along on a Monday morning...
- N
Maybe you are looking for
-
Does anyone have any suggestions for a family needing to share and play iTunes on or via multiple devices? Here's the scenario. i) 3 users in a house. ii) Installed in the house, 2 x Apple TV and a MacMini. iii) 2 Users have MacBooks, one of these us
-
Hello, I'm trying to see my plug-ins and it tells me to go to the Menu, then choose add-ons, and then click the plug-in tab which I would do, but having a Mac and checking up topside I don't have anything of that as a choice. What can I do? thank you
-
Here's my Vent of the Day - How about one topic/thread per subject?
I see lots of topics/threads started that are exactly the same as ones already out there, and many of those could be answered if the OP would just search what's already been said, or read generally available information before posting. And then there
-
Hello I create an ArrayList with some set of values. Now i dont want the ArrayList to be modified. How is this possible?
-
Edit documentation of the program
hi Experts, could u please tell me? How can i edit in documentation of the program?